Codex knows Powershell and Azure

Leveraging the language from the post, Codex knows Docker! Successfully Generating An Entire Docker Project (ft. Dockerfile, Docker-Compose.yml, etc.) I derived a similar approach using Powershell. Codex began repeating itself so it is far from perfect.
However, it does show that GPT3 is clearly multi-lingual :wink: and that codex is just starting.
Below was generated using Davinci-codex, response length 2048, Top 1, Best Of 1, Frequency & Presence Penalty 0
And just like with @ DutytoDevelop 's post, you’ll need to delete the single quotes before hitting generate.

If anyone has tips on how to not make this thing get lost in a repeat sequence, I’d greatly appreciate feedback :slight_smile:
Cheers everyone


Using Microsoft Azure and Microsoft Visual Studio Code create an application that will listen for an HTTP POST. Please create the the Azure Blob Storage and randomly generate all necessary names. Please create the Azure Logic App. Develop using Powershell when possible otherwise develop using Python.

Azure Blob Storage:
#CreateNew: 1. Create a new Azure Blob storage 
Azure Logic App:
#Title: 1. Save the Logic App as myListen
#HttpRequest: 1. Create a trigger for an HTTP Request. 2. Next check and verify that the content-type is json. 3. Next check and verify that the API KEY has a value of HammerTime 4. If the API KEY does not equal HammerTime then end the flow and return the HTTP Response 404 5. If the API KEY does euqal HammerTime then continue
#SaveToBlob: 1. Save the body of the HttpRequest to the blob storage created earlier
write-host EOF

#Create a new Azure Blob storage
$storageAccount = New-AzStorageAccount -ResourceGroupName myResourceGroup -Name myStorageAccount -SkuName Standard_LRS -Location westus

#Create a new Azure Logic App
$logicApp = New-AzLogicApp -ResourceGroupName myResourceGroup -Name myListen -Location westus -Sku S1

#Create a new Azure Logic App Action
$action = New-AzLogicAppAction -ResourceGroupName myResourceGroup -LogicAppName myListen -Name myAction -Type Http -ContentType "application/json" -HttpRequestMethod POST -Uri "https://mystorageaccount.blob.core.windows.net/mycontainer/myblob"

#Create a new Azure Logic App Trigger
$trigger = New-AzLogicAppTriggerHttpRequest -ResourceGroupName myResourceGroup -LogicAppName myListen -Name myTrigger -SourceType Http -ContentType "application/json" -Uri "https://mystorageaccount.blob.core.windows.net/mycontainer/myblob" -ApiKey HammerTime

#Save the Logic App as myListen
$logicApp | Set-AzLogicApp -Name myListen

#Save the Logic App Action as myAction
$action | Set-AzLogicAppAction -Name myAction -LogicAppName myListen

#Save the Logic App Trigger as myTrigger
$trigger | Set-AzLogicAppTriggerHttpRequest -Name myTrigger -LogicAppName myListen

#Save the Logic App as myListen
$logicApp | Set-AzLogicApp -Name myListen

#Save the Logic App Action as myAction
$action | Set-AzLogicAppAction -Name myAction -LogicAppName myListen

#Save the Logic App Trigger as myTrigger
$trigger | Set-AzLogicAppTriggerHttpRequest -Name myTrigger -LogicAppName myListen

#Save the Logic App as myListen
$logicApp | Set-AzLogicApp -Name myListen

#Save the Logic App Action as myAction
$action | Set-AzLogicAppAction -Name myAction -LogicAppName myListen

#Save the Logic App Trigger as myTrigger
$trigger | Set-AzLogicAppTriggerHttpRequest -Name myTrigger -LogicAppName myListen

#Save the Logic App as myListen
$logicApp | Set-AzLogicApp -Name myListen

#Save the Logic App Action as myAction
$action | Set-AzLogicAppAction -Name myAction -LogicAppName myListen

#Save the Logic App Trigger as myTrigger
$trigger | Set-AzLogicAppTriggerHttpRequest -Name myTrigger -LogicAppName myListen

#Save the Logic App as myListen
$logicApp | Set-AzLogicApp -Name myListen

#Save the Logic App Action as myAction
4 Likes

@CajunChuck,

Woah! Nice to see that Codex is fairly adjusted to working with Azure, too!

As for keeping Codex from repeating itself, I can certainly look into the prompt design to see what factors seem to influence Codex’s output that causes the repeating text and hopefully design a prompt that counteracts that output so I can inform you of what worked!

I’ve unfortunately been super busy lately which is why I haven’t been as active, but I do plan to be more active as the week goes on so I can catch up with everyone on here and continue helping people out with their endeavors!

2 Likes

I would try to make the prompt into a list of things you want it to do instead of a paragraph. I found that it’s able to make more sense of the prompt when its structured in a list vs a single paragraph.

2 Likes

yeah, totally agree that 2048 is very ambitious… but hey… .why go with the light version when I can have the extra strength ? :slight_smile:

Definitely keeping the narrative small and in tiny bursts is the best way to go, today.

Heh… #life eh! There’s always things demanding our time cycles.
It’d be cool to develop a narrative that allowed Codex to generate the Azure Logic App http_trigger and the “Save To”.
Effectively, what appears functionally to humans and most app would be an API.

Think of what that would mean in terms of on-boarding more humans on the platform. I can already visualize some IDE extension reading in the data from OpenAI (we’ll eventually be paying per word here…) and then locally applying some coding corrections (example: security things like where to shove secrets, keys, pws.).

…what’s neat is the output is also a ‘Learn howto Azure’ :stuck_out_tongue:

1 Like

You nailed it! There’s an art in the word placement. Some things are best in a paragraph. Somethings are best in a list. … I wonder if square brackets and round brackets have any meaningful impact…

Maybe more like an old-fashion Zork game…
You have entered the main dungeon hall. Deep in the back of the hallway lies a throne. To your right is a torch and to your left is a shield.
Please type your action:> next_action

So in my example, make your storage. Next action? Make the logic app. Next action? Look for an attachment Next action?

… that might work out better… hrm…

@m-a.schenk && @joett.ocasio,
Thank you for your input. Building on what you were suggesting I came out with the text below.
Same temps as before with an Inject Restart Text this time of Next Instruction#

I fed it the lines below to start

Using Microsoft Azure and Microsoft Visual Studio Code create an application with Azure Logic Apps and Azure Blob Storage. Develop using Powershell when possible otherwise develop using Python. 
Please create the the Azure Blob Storage and randomly generate all necessary names. Please create a new Azure Logic App and title it MyNewLogicApp. Follow the instructions below. 
Next Instruction# Create a new Azure Blob storage
Next Instruction# Create a new Azure Logic App and title it MyNewLogicApp
Next Instruction# MyNewLogicApp will begin with an HTTP Request Trigger. Label this trigger as inHTTP
Next Instruction# Check and verify that the content-type is JSON
Next Instruction# Check and verify that the API KEY has a value of HammerTime
Next Instruction# MyNewLogicApp will create a new condition and label it Check4Key
Next Instruction# IF inHTTP does not contain the API KEY 
Next Instruction#   THEN return a 403 not authorized message to the requestor and TERMINATE the flow
#Create a new Azure Blob storage
$storageAccount = New-AzStorageAccount -ResourceGroupName myResourceGroup -Name myStorageAccount -SkuName Standard_LRS -Location westus
#Create a new Azure Logic App
$logicApp = New-AzLogicApp -ResourceGroupName myResourceGroup -Name MyNewLogicApp -Location westus -Sku S1

Codex spat out the text below. I had one stop and restart and I forgot which layer of text I copy/pasted! This what codex generated below.

#MyNewLogicApp will begin with an HTTP Request Trigger. Label this trigger as inHTTP
$inHttp = New-AzLogicAppTriggerHttpRequest -Name inHTTP -LogicApp $logicApp -Uri https://www.google.com -Method POST -Body ""
#Check and verify that the content-type is JSON
$inHttp.ContentType = "application/json"
#Check and verify that the API KEY has a value of HammerTime
$inHttp.Headers.Add("x-api-key", "HammerTime")
#MyNewLogicApp will create a new condition and label it Check4Key
$check4Key = New-AzLogicAppCondition -Name Check4Key -LogicApp $logicApp -ConditionType "All"
#IF inHTTP does not contain the API KEY then terminate the flow and a 403 Not Authorized message will be returned
$check4Key.Conditions.Add($inHttp)
$check4Key.ConditionType = "Not"
$check4Key.Properties.Add("statusCode", "403")
$check4Key.Properties.Add("body", "Not Authorized")
$check4Key.Properties.Add("bodyType", "Text")
$check4Key.Properties.Add("statusDescription", "Not Authorized")
$check4Key.Properties.Add("isBodyHtml", $false)
$check4Key.Properties.Add("contentType", "text/html")
$check4Key.Properties.Add("contentEncoding", "utf-8")
$check4Key.Properties.Add("contentLanguage", "en-US")
$check4Key.Properties.Add("contentDisposition", "inline")
$check4Key.Properties.Add("cacheControl", "no-cache")
$check4Key.Properties.Add("allow", "GET,HEAD,OPTIONS")
$check4Key.Properties.Add("expires", "0")
$check4Key.Properties.Add("pragma", "no-cache")
$check4Key.Properties.Add("x-ms-blob-type", "BlockBlob")
$check4Key.Properties.Add("x-ms-meta-name", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-value", "HammerTime")
$check4Key.Properties.Add("x-ms-version", "2018-11-09")
$check4Key.Properties.Add("x-ms-blob-content-type", "text/html")
$check4Key.Properties.Add("x-ms-blob-content-encoding", "utf-8")
$check4Key.Properties.Add("x-ms-blob-content-language", "en-US")
$check4Key.Properties.Add("x-ms-blob-content-disposition", "inline")
$check4Key.Properties.Add("x-ms-blob-cache-control", "no-cache")
$check4Key.Properties.Add("x-ms-blob-content-length", "0")
$check4Key.Properties.Add("x-ms-blob-sequence-number", "0")
$check4Key.Properties.Add("x-ms-blob-content-md5", "Q2hlY2sgSW50ZWdyaXR5IQ==")
$check4Key.Properties.Add("x-ms-meta-target-name", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-target-value", "HammerTime")

Though I think the properties.add is a bit much, all of the above makes sense. Now below is the weird part. I don’t understand what prompted codex to think this was the next best line to match my intent.

$check4Key.Properties.Add("x-ms-meta-abc", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-bcd", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-efg", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-hij", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-klm", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-nop", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-qrs", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-tuv", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-wxy", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-yza", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-asd", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-fgh", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-jkl", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-pqr", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-stu", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-vwx", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-yza", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-zab", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-asd", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-fgh", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-jkl", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-pqr", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-stu", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-vwx", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-yza", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-zab", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-asd", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-fgh", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-jkl", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-pqr", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-stu", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-vwx", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-yza", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-zab", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-asd", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-fgh", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-jkl", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-pqr", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-stu", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-vwx", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-yza", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-zab", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-asd", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-fgh", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-jkl", "HammerTime")
$check4Key.Properties.Add("x-ms-meta-pqr", "HammerTime
Next Instruction#

Now it didn’t trail off into the sunset. Rather, it ran through some letter combo cycle, called them each HammerTime and then gave it back to the user for the Next Instruction#
Clearly some narrative work to do. :slight_smile: Thanks again for the input

Cheers mates,
~CC

Now, this was some interesting output!!
This is what I fed Codex. See attached FF12 for the temps.

Using Microsoft Azure and Microsoft Visual Studio Code create an application with Azure Logic Apps and Azure Blob Storage. Develop using Powershell when possible otherwise develop using Python. 
Please create the the Azure Blob Storage. Please create a new Azure Logic App and title it MyNewLogicApp. Follow the instructions below. 
Next Instruction# Create a new Azure Blob storage.
Next Instruction# Create a new Azure Logic App and title it MyNewLogicApp.
Next Instruction# MyNewLogicApp will trigger When a HTTP request is received. 
Next Instruction# Label this trigger as inHTTP.
Next Instruction# inHTTP will use the following Request Body JSON Schema { "properties": { "items": { "type": "string" } }, "type": "object" }
Next Instruction# Check and verify that the content-type is JSON
Next Instruction# Check and verify that the API KEY has a value of HammerTime
Next Instruction# MyNewLogicApp will create a new condition and label it Check4Key
Next Instruction# Check4Key uses an IF THEN ELSE logic
Next Instruction# IF inHTTP does not contain the API KEY; THEN Check4Key will return to the requestor a standard 403 forbidden message AND terminate the MyNewLogicApp 
Next Instruction# IF inHTTP does contain the API KEY; THEN Continue
Next Instruction# INJECT RESTART TEXT
Action#Create a new Azure Blob storage
$storageAccount = New-AzStorageAccount -ResourceGroupName myResourceGroup -Name myStorageAccount -SkuName Standard_LRS -Location westus
Action#Create a new Azure Logic App
$logicApp = New-AzLogicApp -ResourceGroupName myResourceGroup -Name MyNewLogicApp -Location westus -Sku S1

This is where I stopped. My cursor sat idle after S1. -Workflow is Codex’s own doing. Now this is where it got interesting. I guess because of my previous instruction with some json formatted text the engine figured it was better to continue with json?
This is an interesting StickyNote; using GPT3 to generate bits of text that a human logically stitches together in another shape which is then ingested by the generative engine to produce code. As this Human-Machine feedback loop continues the overall text should be getting closer to matching the dev’s original intent.
Training language is key and I still maintain this is the tech support matrix of not-that-far-tomorrow.
Anyhow, I’m babbling…

Codex wasn’t that precise… though I like the idea of using the workflow with json formatted text, the output wouldn’t work. This is almost a step backward as my previous attempts were trying to massage powershell cmdlets.

$logicApp = New-AzLogicApp -ResourceGroupName myResourceGroup -Name MyNewLogicApp -Location westus -Sku S1 -Workflow @"
{
  '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#',
  'contentVersion': '1.0.0.0',
  'parameters': {
    'items': {
      'type': 'string'
    }
  },
  'triggers': {
    'inHTTP': {
      'type': 'http',
      'schema': {
        'type': 'object',
        'properties': {
          'items': {
            'type': 'string'
          }
        },
        'required': [
          'items'
        ]
      },
      'method': 'post',
      'url': 'https://mystorageaccount.blob.core.windows.net/mycontainer/myblob',
      'headers': {
        'content-type': 'application/json'
      },
      'body': '{ "items": $input.json(\'$.items\') }'
    }
  },
  'actions': {
    'Restart': {
      'type': 'restart'
    }
  },
  'triggers': {
    'Check4Key': {
      'type': 'conditional',
      'condition': 'not contains(azure-asyncoperation, "does not exist")',
      'trueAction': 'Restart',
      'falseAction': 'error'
    }
  }
}
"@
Action#Create a new Azure Blob storage
$storageAccount = New-AzStorageAccount -ResourceGroupName myResourceGroup -Name myStorageAccount -SkuName Standard_LRS -Location westus
Action#Create a new Azure Logic App
$logicApp = New-AzLogicApp -ResourceGroupName myResourceGroup -Name MyNewLogicApp -Location westus -Sku S1 -Workflow @"
{
  '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#',
  'contentVersion': '1.0.0.0',
  'parameters': {
    'items': {
      'type': 'string'
    }
  },
  'triggers': {
    'inHTTP': {
      'type': 'http',
      'schema': {
        'type': 'object',
        'properties': {
          'items': {
            'type': 'string'
          }
        },
        'required': [
          'items'
        ]
      },
      'method': 'post',
      'url': 'https://mystorageaccount.blob.core.windows.net/mycontainer/myblob',
      'headers': {
        'content-type': 'application/json'
      },
      'body': '{ "items": $input.json(\'$.items\') }'
    }
  },
  'actions': {
    'Restart': {
      'type': 'restart'
    }
  },
  'triggers': {
    'Check4Key': {
      'type': 'conditional',
      'condition': 'not contains(azure-asyncoperation, "does not exist")',
      'trueAction': 'Restart',
      'falseAction': 'error'
    }
  }
}
"@
Action#Create a new Azure Blob storage
$storageAccount = New-AzStorageAccount -ResourceGroupName myResourceGroup -Name myStorageAccount -SkuName Standard_LRS -Location westus
Action#Create a new Azure Logic App
$logicApp = New-AzLogicApp -ResourceGroupName myResourceGroup -Name MyNewLogicApp -Location westus -Sku S1 -Workflow @"
{
  '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#',
  'contentVersion': '1.0.0.0',
  'parameters': {
    'items': {
      'type': 'string'
    }
  },
  'triggers': {
    'inHTTP': {
      'type': 'http',
Next Instruction

I gotta put my thinking cap back. This is a neat test! It’s a heck-of-a-thing for a major cloud vendor, like Microsoft Azure, to have a narrative from a user produce executable code that right away puts the individual in touch with their transaction apps.