Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: Updating Azure API versions to latest #987

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Release Notes
=============
## 1.7.12
* Maintenance: Updating Azure API versions to latest

## 1.7.11
* Dedicated Hosts: Support for Host Groups and Hosts
* WebApps: Added support for Node 14, 16 and 18

## 1.7.10
* Container Groups and Container Apps: Support for link_to_identity for ACR managed identities.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/api-overview/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This will be written to the ARM template file as follows:
"appSettings": [
{
"name": "storageKey",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=myStorageAccount;AccountKey=', listKeys('myStorageAccount', '2017-10-01').keys[0].value)]"
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=myStorageAccount;AccountKey=', listKeys('myStorageAccount', '2022-05-01').keys[0].value)]"
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/content/api-overview/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This will generate an ARM template which looks as follows (irrelevant content is
},
"resources": [
{
"apiVersion": "2014-04-01-preview",
"apiVersion": "2021-11-01",
"name": "myserver",
"properties": {
"administratorLogin": "mradmin",
Expand Down
2 changes: 1 addition & 1 deletion docs/content/contributing/arm-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ Your resource you create will have a [type of service](https://docs.microsoft.co
### Where can I find docs on ARM templates schemas themselves?
There are three good sources to learning about specific ARM resources and what parts need to be used in creating an equivalent Farmer resource:

* **Reference Docs**: The reference documentation contains details on the schema for every resource and every version e.g. [Container Registry](https://docs.microsoft.com/en-us/azure/templates/microsoft.containerregistry/2017-10-01/registries) reference.
* **Reference Docs**: The reference documentation contains details on the schema for every resource and every version e.g. [Container Registry](https://docs.microsoft.com/en-us/azure/templates/microsoft.containerregistry/2021-09-01/registries) reference.
* **Sample Template**: The Azure Quickstart Templates github repository contains many examples of real-world ARM templates e.g. [Container Registry with Geo Replication](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.containerregistry/container-registry-geo-replication) sample.
* **Reverse engineer**: You can manually create a required resource in Azure, and then use Azure's [export ARM template](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/export-template-portal) functionality to create an ARM template. It's important that you test out the exported template yourself before porting it to Farmer, because Azure sometimes exports invalid templates!
2 changes: 1 addition & 1 deletion docs/content/contributing/outputs-and-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Farmer ARM expressions are in reality just wrapped strings, and are easy to crea
let buildKey accountName : ArmExpression =
// Create the raw string of the expression
let rawValue =
$"concat('DefaultEndpointsProtocol=https;AccountName={accountName};AccountKey=', listKeys('{accountName}', '2017-10-01').keys[0].value)"
$"concat('DefaultEndpointsProtocol=https;AccountName={accountName};AccountKey=', listKeys('{accountName}', '2022-05-01').keys[0].value)"

// Wrap the raw value in an ARM Expression and return it
ArmExpression.create rawValue
Expand Down
2 changes: 1 addition & 1 deletion docs/content/quickstarts/quickstart-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Also observe the application setting that has been created:
"appSettings": [
{
"name": "storageKey",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=yourfirststorage;AccountKey=', listKeys('yourfirststorage', '2017-10-01').keys[0].value)]"
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=yourfirststorage;AccountKey=', listKeys('yourfirststorage', '2022-05-01').keys[0].value)]"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion samples/scripts/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"resources": [
{
"apiVersion": "2019-06-01",
"apiVersion": "2022-05-01",
"dependsOn": [],
"kind": "StorageV2",
"location": "westeurope",
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Arm/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type ManagedEnvironmentStorage =
ShareName = share
AccountName = accountName
AccountKey =
$"[listKeys('Microsoft.Storage/storageAccounts/{accountName.ResourceName.Value}', '2018-07-01').keys[0].value]"
$"[listKeys('Microsoft.Storage/storageAccounts/{accountName.ResourceName.Value}', '2022-05-01').keys[0].value]"
AccessMode = accessMode
|}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Arm/ContainerInstance.fs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ type ContainerGroup =
shareName = shareName.Value
storageAccountName = accountName.ResourceName.Value
storageAccountKey =
$"[listKeys('Microsoft.Storage/storageAccounts/{accountName.ResourceName.Value}', '2018-07-01').keys[0].value]"
$"[listKeys('Microsoft.Storage/storageAccounts/{accountName.ResourceName.Value}', '2022-05-01').keys[0].value]"
|}
emptyDir = null
gitRepo = Unchecked.defaultof<_>
Expand Down
5 changes: 2 additions & 3 deletions src/Farmer/Arm/EventGrid.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ module Farmer.Arm.EventGrid
open Farmer
open EventGrid

let systemTopics =
ResourceType("Microsoft.EventGrid/systemTopics", "2020-04-01-preview")
let systemTopics = ResourceType("Microsoft.EventGrid/systemTopics", "2022-06-15")

let eventSubscriptions =
ResourceType("Microsoft.EventGrid/systemTopics/eventSubscriptions", "2020-04-01-preview")
ResourceType("Microsoft.EventGrid/systemTopics/eventSubscriptions", "2022-06-15")

type TopicType =
| TopicType of ResourceType * topic: string
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Arm/Insights.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let private createComponents version =
ResourceType("Microsoft.Insights/components", version)

/// Classic AI instance
let components = createComponents "2014-04-01"
let components = createComponents "2015-05-01"
/// Workspace-enabled AI instance
let componentsWorkspace = createComponents "2020-02-02"

Expand Down
8 changes: 4 additions & 4 deletions src/Farmer/Arm/KeyVault.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ open Farmer
open Farmer.KeyVault
open System

let secrets = ResourceType("Microsoft.KeyVault/vaults/secrets", "2019-09-01")
let secrets = ResourceType("Microsoft.KeyVault/vaults/secrets", "2022-07-01")

let accessPolicies =
ResourceType("Microsoft.KeyVault/vaults/accessPolicies", "2019-09-01")
ResourceType("Microsoft.KeyVault/vaults/accessPolicies", "2022-07-01")

let vaults = ResourceType("Microsoft.KeyVault/vaults", "2019-09-01")
let keys = ResourceType("Microsoft.keyVault/vaults/keys", "2019-09-01")
let vaults = ResourceType("Microsoft.KeyVault/vaults", "2022-07-01")
let keys = ResourceType("Microsoft.keyVault/vaults/keys", "2022-07-01")

module Vaults =
type Secret =
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Arm/LogAnalytics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Farmer.Arm.LogAnalytics
open Farmer

let workspaces =
ResourceType("Microsoft.OperationalInsights/workspaces", "2020-03-01-preview")
ResourceType("Microsoft.OperationalInsights/workspaces", "2022-10-01")

type Workspace =
{
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Arm/RoleAssignment.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Farmer.Arm.RoleAssignment
open Farmer

let roleAssignments =
ResourceType("Microsoft.Authorization/roleAssignments", "2021-04-01-preview")
ResourceType("Microsoft.Authorization/roleAssignments", "2022-04-01")

[<RequireQualifiedAccess>]
type PrincipalType =
Expand Down
12 changes: 5 additions & 7 deletions src/Farmer/Arm/Sql.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ open Farmer
open Farmer.Sql
open System.Net

let servers = ResourceType("Microsoft.Sql/servers", "2019-06-01-preview")
let servers = ResourceType("Microsoft.Sql/servers", "2021-11-01")

let elasticPools =
ResourceType("Microsoft.Sql/servers/elasticPools", "2017-10-01-preview")
let elasticPools = ResourceType("Microsoft.Sql/servers/elasticPools", "2021-11-01")

let firewallRules =
ResourceType("Microsoft.Sql/servers/firewallrules", "2014-04-01")
ResourceType("Microsoft.Sql/servers/firewallrules", "2021-11-01")

let databases =
ResourceType("Microsoft.Sql/servers/databases", "2019-06-01-preview")
let databases = ResourceType("Microsoft.Sql/servers/databases", "2021-11-01")

let transparentDataEncryption =
ResourceType("Microsoft.Sql/servers/databases/transparentDataEncryption", "2014-04-01-preview")
ResourceType("Microsoft.Sql/servers/databases/transparentDataEncryption", "2021-11-01")

type DbKind =
| Standalone of DbPurchaseModel
Expand Down
22 changes: 11 additions & 11 deletions src/Farmer/Arm/Storage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ open Farmer
open Farmer.Storage

let storageAccounts =
ResourceType("Microsoft.Storage/storageAccounts", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts", "2022-05-01")

let blobServices =
ResourceType("Microsoft.Storage/storageAccounts/blobServices", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/blobServices", "2022-05-01")

let containers =
ResourceType("Microsoft.Storage/storageAccounts/blobServices/containers", "2018-03-01-preview")
ResourceType("Microsoft.Storage/storageAccounts/blobServices/containers", "2022-05-01")

let fileServices =
ResourceType("Microsoft.Storage/storageAccounts/fileServices", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/fileServices", "2022-05-01")

let fileShares =
ResourceType("Microsoft.Storage/storageAccounts/fileServices/shares", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/fileServices/shares", "2022-05-01")

let queueServices =
ResourceType("Microsoft.Storage/storageAccounts/queueServices", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/queueServices", "2022-05-01")

let queues =
ResourceType("Microsoft.Storage/storageAccounts/queueServices/queues", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/queueServices/queues", "2022-05-01")

let tableServices =
ResourceType("Microsoft.Storage/storageAccounts/tableServices", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/tableServices", "2022-05-01")

let tables =
ResourceType("Microsoft.Storage/storageAccounts/tableServices/tables", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/tableServices/tables", "2022-05-01")

let managementPolicies =
ResourceType("Microsoft.Storage/storageAccounts/managementPolicies", "2019-06-01")
ResourceType("Microsoft.Storage/storageAccounts/managementPolicies", "2022-05-01")

let roleAssignments =
ResourceType("Microsoft.Storage/storageAccounts/providers/roleAssignments", "2018-09-01-preview")
ResourceType("Microsoft.Storage/storageAccounts/providers/roleAssignments", "2022-05-01")

[<RequireQualifiedAccess>]
type NetworkRuleSetBypass =
Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Arm/Web.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open Farmer.Identity
open Farmer.WebApp
open System

let serverFarms = ResourceType("Microsoft.Web/serverfarms", "2018-02-01")
let serverFarms = ResourceType("Microsoft.Web/serverfarms", "2022-03-01")
let sites = ResourceType("Microsoft.Web/sites", "2021-03-01")
let config = ResourceType("Microsoft.Web/sites/config", "2016-08-01")

Expand Down
2 changes: 1 addition & 1 deletion src/Farmer/Builders/Builders.Storage.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type StorageAccount =
/// Gets an ARM Expression connection string for any Storage Account.
static member getConnectionString(storageAccount: ResourceId) =
let expr =
$"concat('DefaultEndpointsProtocol=https;AccountName={storageAccount.Name.Value};AccountKey=', listKeys({storageAccount.ArmExpression.Value}, '2017-10-01').keys[0].value)"
$"concat('DefaultEndpointsProtocol=https;AccountName={storageAccount.Name.Value};AccountKey=', listKeys({storageAccount.ArmExpression.Value}, '2022-05-01').keys[0].value)"

ArmExpression.create (expr, storageAccount)

Expand Down
6 changes: 3 additions & 3 deletions src/Tests/AppInsights.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ let tests =

Expect.equal
ai.InstrumentationKey.Value
("reference(resourceId('Microsoft.Insights/components', 'foo'), '2014-04-01').InstrumentationKey")
("reference(resourceId('Microsoft.Insights/components', 'foo'), '2015-05-01').InstrumentationKey")
"Incorrect Value"
}

test "Creates with classic version by default" {
let deployment = arm { add_resource (appInsights { name "foo" }) }
let json = deployment.Template |> Writer.toJson |> JObject.Parse
let version = json.SelectToken("resources[?(@.name=='foo')].apiVersion").ToString()
Expect.equal version "2014-04-01" "Incorrect API version"
Expect.equal version "2015-05-01" "Incorrect API version"
}

test "Create generated keys correctly" {
Expand All @@ -39,7 +39,7 @@ let tests =

Expect.equal
generatedKey.Value
"reference(resourceId('group', 'Microsoft.Insights/components', 'foo'), '2014-04-01').InstrumentationKey"
"reference(resourceId('group', 'Microsoft.Insights/components', 'foo'), '2015-05-01').InstrumentationKey"
"Incorrect generated key"
}

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/CognitiveServices.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let tests =
add_tags [ "a", "1"; "b", "2" ]
}

let model: Models.CognitiveServicesAccount = service |> getResourceAtIndex 0
let model: Models.Account = service |> getResourceAtIndex 0

Expect.equal model.Name "test" "Name is wrong"
Expect.equal model.Kind "TextAnalytics" "Kind is wrong"
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/ContainerApps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ let tests =

Expect.equal
(kubeEnvLogAnalyticsCustomerId.["customerId"] |> string)
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'containerlogs'), '2020-03-01-preview').customerId]"
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'containerlogs'), '2022-10-01').customerId]"
"Incorrect log analytics customerId reference"
}

Expand Down
10 changes: 5 additions & 5 deletions src/Tests/ContainerGroup.fs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ async {

Expect.equal
(firstEnvVar.["secureValue"] |> string)
"[concat('DefaultEndpointsProtocol=https;AccountName=containerdata1234;AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', 'containerdata1234'), '2017-10-01').keys[0].value)]"
"[concat('DefaultEndpointsProtocol=https;AccountName=containerdata1234;AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', 'containerdata1234'), '2022-05-01').keys[0].value)]"
"Incorrect env var expression value"
}
test "Container with liveness and readiness probes" {
Expand Down Expand Up @@ -1102,12 +1102,12 @@ async {

Expect.equal
(string workspaceId)
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'containergrouplogs1234'), '2020-03-01-preview').customerId]"
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'containergrouplogs1234'), '2022-10-01').customerId]"
"Incorrect value for workspaceId"

Expect.equal
(string workspaceKey)
"[listkeys(resourceId('Microsoft.OperationalInsights/workspaces', 'containergrouplogs1234'), '2020-03-01-preview').primarySharedKey]"
"[listkeys(resourceId('Microsoft.OperationalInsights/workspaces', 'containergrouplogs1234'), '2022-10-01').primarySharedKey]"
"Incorrect value for workspaceKey"

Expect.equal (string logType) "ContainerInstanceLogs" "Incorrect value for workspaceId"
Expand Down Expand Up @@ -1153,12 +1153,12 @@ async {

Expect.equal
(string workspaceId)
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'my-log-analytics-workspace'), '2020-03-01-preview').customerId]"
"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'my-log-analytics-workspace'), '2022-10-01').customerId]"
"Incorrect value for workspaceId"

Expect.equal
(string workspaceKey)
"[listkeys(resourceId('Microsoft.OperationalInsights/workspaces', 'my-log-analytics-workspace'), '2020-03-01-preview').primarySharedKey]"
"[listkeys(resourceId('Microsoft.OperationalInsights/workspaces', 'my-log-analytics-workspace'), '2022-10-01').primarySharedKey]"
"Incorrect value for workspaceKey"

Expect.equal (string logType) "ContainerInstanceLogs" "Incorrect value for workspaceId"
Expand Down
17 changes: 9 additions & 8 deletions src/Tests/ContainerService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open Microsoft.Azure.Management.Compute.Models
open Microsoft.Azure.Management.ContainerService
open Microsoft.Rest
open System
open Microsoft.Azure.Management.ContainerService.Models

let dummyClient =
new ContainerServiceClient(Uri "http://management.azure.com", TokenCredentials "NotNullOrWhiteSpace")
Expand All @@ -31,13 +32,13 @@ let tests =

let aks =
template
|> findAzureResources<ContainerService> dummyClient.SerializationSettings
|> findAzureResources<ManagedCluster> dummyClient.SerializationSettings
|> Seq.head

Expect.equal aks.Name "aks-cluster" ""
Expect.hasLength aks.AgentPoolProfiles 1 ""
Expect.equal aks.AgentPoolProfiles.[0].Name "nodepool1" ""
Expect.equal aks.AgentPoolProfiles.[0].Count 3 ""
Expect.equal aks.AgentPoolProfiles.[0].Count (Nullable 3) ""
let json = template.Template |> Writer.toJson
let jobj = Newtonsoft.Json.Linq.JObject.Parse(json)

Expand All @@ -57,13 +58,13 @@ let tests =

let aks =
template
|> findAzureResources<ContainerService> dummyClient.SerializationSettings
|> findAzureResources<ManagedCluster> dummyClient.SerializationSettings
|> Seq.head

Expect.equal aks.Name "aks-cluster" ""
Expect.hasLength aks.AgentPoolProfiles 1 ""
Expect.equal aks.AgentPoolProfiles.[0].Name "nodepool1" ""
Expect.equal aks.AgentPoolProfiles.[0].Count 3 ""
Expect.equal aks.AgentPoolProfiles.[0].Count (Nullable 3) ""
let json = template.Template |> Writer.toJson
let jobj = Newtonsoft.Json.Linq.JObject.Parse(json)

Expand Down Expand Up @@ -100,13 +101,13 @@ let tests =

let aks =
arm { add_resource myAks }
|> findAzureResources<ContainerService> dummyClient.SerializationSettings
|> findAzureResources<ManagedCluster> dummyClient.SerializationSettings
|> Seq.head

Expect.equal aks.Name "k8s-cluster" ""
Expect.hasLength aks.AgentPoolProfiles 1 ""
Expect.equal aks.AgentPoolProfiles.[0].Name "linuxpool" ""
Expect.equal aks.AgentPoolProfiles.[0].Count 3 ""
Expect.equal aks.AgentPoolProfiles.[0].Count (Nullable 3) ""
Expect.equal aks.AgentPoolProfiles.[0].VmSize "Standard_DS2_v2" ""
Expect.equal aks.LinuxProfile.AdminUsername "aksuser" ""
Expect.equal aks.LinuxProfile.Ssh.PublicKeys.Count 1 ""
Expand All @@ -133,7 +134,7 @@ let tests =

let aks =
arm { add_resource myAks }
|> findAzureResources<ContainerService> dummyClient.SerializationSettings
|> findAzureResources<ManagedCluster> dummyClient.SerializationSettings
|> Seq.head

Expect.equal
Expand Down Expand Up @@ -175,7 +176,7 @@ let tests =

let aks =
arm { add_resource myAks }
|> findAzureResources<ContainerService> dummyClient.SerializationSettings
|> findAzureResources<ManagedCluster> dummyClient.SerializationSettings
|> Seq.head

Expect.hasLength aks.AgentPoolProfiles 1 ""
Expand Down
Loading