[Communication] Migrate to Bicep (#30859)
And update API versions. Live tests run: - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072706&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072699&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072700&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072701&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072704&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072705&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072674&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072676&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072679&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072681&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072688&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072691&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072696&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=4072729&view=results Failures are unrelated
This commit is contained in:
Родитель
620aafbc03
Коммит
baaf363a0c
|
@ -56,7 +56,7 @@ For a more in-depth look on how to authenticate using managed identity, refer to
|
|||
|
||||
### Running the New-TestResources and Remove-TestResources Scripts
|
||||
|
||||
You may want to run the `New-TestResources.ps1` or `Remove-TestResources.ps1` scripts to test resource deployments in the SDK Live Test pipelines locally. You will need to add the additional `-TestResourceDirectories` parameter when running these scripts. If you are using the shared `test-resources.json` you can point to `communication/test-resources/`. If you are using a custom `test-resources.json`, you can point to `communication/<package-name>/test-resources.json`.
|
||||
You may want to run the `New-TestResources.ps1` or `Remove-TestResources.ps1` scripts to test resource deployments in the SDK Live Test pipelines locally. You will need to add the additional `-TestResourceDirectories` parameter when running these scripts. If you are using the shared `test-resources.bicep` you can point to `communication/test-resources/`. If you are using a custom `test-resources.bicep`, you can point to `communication/<package-name>/test-resources.bicep`.
|
||||
|
||||
## Submitting a Pull Request
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ npm install @azure/arm-communication
|
|||
To create a client object to access the Azure CommunicationServiceManagement API, you will need the `endpoint` of your Azure CommunicationServiceManagement resource and a `credential`. The Azure CommunicationServiceManagement client can use Azure Active Directory credentials to authenticate.
|
||||
You can find the endpoint for your Azure CommunicationServiceManagement resource in the [Azure Portal][azure_portal].
|
||||
|
||||
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
|
||||
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).
|
||||
|
||||
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ if (createCallEventResult.isSuccess)
|
|||
|
||||
## Contributing
|
||||
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
|
||||
<!-- LINKS -->
|
||||
[overview]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-automation
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/textanalytics/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ use-extension:
|
|||
|
||||
## Customizations for Email Client Generator
|
||||
|
||||
See the [AutoRest samples](https://github.com/Azure/autorest/tree/master/Samples/3b-custom-transformations)
|
||||
See the [AutoRest samples](https://github.com/Azure/autorest/tree/main/Samples/3b-custom-transformations)
|
||||
for more about how we're customizing things.
|
||||
|
||||
### Remove "To" from the required properties
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
param baseName string = resourceGroup().name
|
||||
param endpointPrefix string = 'communication'
|
||||
param testApplicationOid string
|
||||
|
||||
var apiVersion = '2023-06-01-preview'
|
||||
var uniqueSubDomainName = '${baseName}-${endpointPrefix}'
|
||||
var emailServiceName = '${uniqueSubDomainName}-email-service'
|
||||
var contributorRoleId = 'b24988ac-6180-42a0-ab88-20f7382dd24c'
|
||||
|
||||
// Create Communication Service
|
||||
resource communicationService 'Microsoft.Communication/communicationServices@2023-06-01-preview' = {
|
||||
name: uniqueSubDomainName
|
||||
location: 'global'
|
||||
properties: {
|
||||
dataLocation: 'UnitedStates'
|
||||
linkedDomains: [
|
||||
resourceId('Microsoft.Communication/EmailServices/Domains', emailServiceName, 'AzureManagedDomain')
|
||||
]
|
||||
}
|
||||
dependsOn: [
|
||||
emailService::AzureManagedDomain
|
||||
]
|
||||
}
|
||||
|
||||
// Assign Contributor Role to Test Application
|
||||
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
|
||||
name: guid(resourceGroup().id, deployment().name, baseName, contributorRoleId)
|
||||
properties: {
|
||||
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', contributorRoleId)
|
||||
principalId: testApplicationOid
|
||||
}
|
||||
}
|
||||
|
||||
// Create Email Service with Domain
|
||||
resource emailService 'Microsoft.Communication/emailServices@2023-06-01-preview' = {
|
||||
name: emailServiceName
|
||||
location: 'global'
|
||||
properties: {
|
||||
dataLocation: 'UnitedStates'
|
||||
}
|
||||
resource AzureManagedDomain 'Domains' = {
|
||||
name: 'AzureManagedDomain'
|
||||
location: 'global'
|
||||
properties: {
|
||||
domainManagement: 'AzureManaged'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Outputs
|
||||
output COMMUNICATION_ENDPOINT string = communicationService.properties.hostName
|
||||
output COMMUNICATION_CONNECTION_STRING string = listKeys(communicationService.id, apiVersion).primaryConnectionString
|
||||
output COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING string = listKeys(communicationService.id, apiVersion).primaryConnectionString
|
||||
output RESOURCE_GROUP_NAME string = resourceGroup().name
|
||||
output COMMUNICATION_CONNECTION_STRING_EMAIL string = listKeys(communicationService.id, apiVersion).primaryConnectionString
|
||||
output SENDER_ADDRESS string = format('DoNotReply@{0}', emailService::AzureManagedDomain.properties.mailFromSenderDomain)
|
||||
output RECIPIENT_ADDRESS string = 'acseaastesting@gmail.com'
|
||||
output SECOND_RECIPIENT_ADDRESS string = 'acseaastesting@gmail.com'
|
|
@ -1,142 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"baseName": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().name]",
|
||||
"metadata": {
|
||||
"description": "The base resource name."
|
||||
}
|
||||
},
|
||||
"endpointPrefix": {
|
||||
"defaultValue": "communication",
|
||||
"type": "string"
|
||||
},
|
||||
"communicationServicesEndpointSuffix": {
|
||||
"defaultValue": ".communication.azure.com",
|
||||
"type": "string"
|
||||
},
|
||||
"testApplicationOid": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The client OID to grant access to test resources."
|
||||
}
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The tenant id to which the application and resources belong."
|
||||
}
|
||||
},
|
||||
"testApplicationId": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The application client id used to run tests."
|
||||
}
|
||||
},
|
||||
"testApplicationSecret": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The application client secret used to run tests."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"uniqueSubDomainName": "[format('{0}-{1}', parameters('baseName'), parameters('endpointPrefix'))]",
|
||||
"emailServiceName": "[format('{0}-{1}', variables('uniqueSubDomainName'), 'email-service')]",
|
||||
"contributorRoleId": "b24988ac-6180-42a0-ab88-20f7382dd24c"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Communication/CommunicationServices",
|
||||
"apiVersion": "2021-10-01-preview",
|
||||
"name": "[variables('uniqueSubDomainName')]",
|
||||
"location": "global",
|
||||
"properties": {
|
||||
"dataLocation": "UnitedStates",
|
||||
"linkedDomains": [
|
||||
"[resourceId('Microsoft.Communication/EmailServices/Domains', variables('emailServiceName'), 'AzureManagedDomain')]"
|
||||
]
|
||||
},
|
||||
"dependsOn": ["AzureManagedDomain"]
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Authorization/roleAssignments",
|
||||
"apiVersion": "2019-04-01-preview",
|
||||
"name": "[guid(resourceGroup().id, deployment().name, parameters('baseName'), variables('contributorRoleId'))]",
|
||||
"properties": {
|
||||
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('contributorRoleId'))]",
|
||||
"principalId": "[parameters('testApplicationOid')]",
|
||||
"scope": "[resourceGroup().id]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Communication/EmailServices",
|
||||
"apiVersion": "2021-10-01-preview",
|
||||
"name": "[variables('emailServiceName')]",
|
||||
"location": "global",
|
||||
"properties": {
|
||||
"dataLocation": "UnitedStates"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Domains",
|
||||
"apiVersion": "2021-10-01-preview",
|
||||
"name": "AzureManagedDomain",
|
||||
"location": "global",
|
||||
"dependsOn": ["[variables('emailServiceName')]"],
|
||||
"properties": {
|
||||
"domainManagement": "AzureManaged"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"AZURE_TENANT_ID": {
|
||||
"type": "string",
|
||||
"value": "[parameters('tenantId')]"
|
||||
},
|
||||
"AZURE_CLIENT_ID": {
|
||||
"type": "string",
|
||||
"value": "[parameters('testApplicationId')]"
|
||||
},
|
||||
"AZURE_CLIENT_SECRET": {
|
||||
"type": "string",
|
||||
"value": "[parameters('testApplicationSecret')]"
|
||||
},
|
||||
"COMMUNICATION_ENDPOINT": {
|
||||
"type": "string",
|
||||
"value": "[concat('https://', parameters('baseName'), '-', parameters('endpointPrefix'), parameters('communicationServicesEndpointSuffix'))]"
|
||||
},
|
||||
"COMMUNICATION_CONNECTION_STRING": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2021-10-01-preview').primaryConnectionString]"
|
||||
},
|
||||
"COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2021-10-01-preview').primaryConnectionString]"
|
||||
},
|
||||
"RESOURCE_GROUP_NAME": {
|
||||
"type": "string",
|
||||
"value": "[resourceGroup().Name]"
|
||||
},
|
||||
"COMMUNICATION_CONNECTION_STRING_EMAIL": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2021-10-01-preview').primaryConnectionString]"
|
||||
},
|
||||
"SENDER_ADDRESS": {
|
||||
"type": "string",
|
||||
"value": "[format('{0}@{1}', 'DoNotReply', reference(resourceId('Microsoft.Communication/EmailServices/Domains', variables('emailServiceName'), 'AzureManagedDomain')).mailFromSenderDomain)]"
|
||||
},
|
||||
"RECIPIENT_ADDRESS": {
|
||||
"type": "string",
|
||||
"value": "acseaastesting@gmail.com"
|
||||
},
|
||||
"SECOND_RECIPIENT_ADDRESS": {
|
||||
"type": "string",
|
||||
"value": "acseaastesting@gmail.com"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Testing
|
||||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md#testing).
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/master/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/textanalytics/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/bl
|
|||
|
||||
## Contributing
|
||||
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
||||
|
||||
|
||||
## Related projects
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/textanalytics/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
To test this project, make sure to build it by following our [building instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#building), then follow the [testing instructions](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md#testing).
|
||||
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use an [ARM template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.json) that already has all of the the necessary configurations.
|
||||
You can use existing Azure resources for the live tests, or generate new ones by using our [New-TestResources.ps1](https://github.com/Azure/azure-sdk-for-js/blob/main/eng/common/TestResources/New-TestResources.ps1) script, which will use a [Bicep template](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/test-resources/test-resources.bicep) that already has all of the the necessary configurations.
|
||||
|
||||
The Azure resource that is used by the tests in this project is:
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# This script is used to set up SIP Configuration domains for Azure Communication Services SIP Routing SDK GA tests
|
||||
|
||||
# It is invoked by the https://github.com/Azure/azure-sdk-for-js/blob/main/eng/New-TestResources.ps1
|
||||
# script after the ARM template, defined in https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/test-resources.json,
|
||||
# script after the Bicep template, defined in https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/test-resources.bicep,
|
||||
# is finished being deployed. The ARM template is responsible for creating the Storage accounts needed for live tests.
|
||||
|
||||
param (
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
param baseName string = resourceGroup().name
|
||||
param endpointPrefix string = 'communication'
|
||||
param testApplicationOid string
|
||||
|
||||
var apiVersion = '2023-06-01-preview'
|
||||
var uniqueSubDomainName = '${baseName}-${endpointPrefix}'
|
||||
var contributorRoleId = 'b24988ac-6180-42a0-ab88-20f7382dd24c'
|
||||
|
||||
// Create Communication Service
|
||||
resource communicationService 'Microsoft.Communication/communicationServices@2023-06-01-preview' = {
|
||||
name: uniqueSubDomainName
|
||||
location: 'global'
|
||||
properties: {
|
||||
dataLocation: 'UnitedStates'
|
||||
}
|
||||
}
|
||||
|
||||
// Assign Contributor Role to Test Application
|
||||
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
|
||||
name: guid(resourceGroup().id, deployment().name, baseName, contributorRoleId)
|
||||
properties: {
|
||||
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', contributorRoleId)
|
||||
principalId: testApplicationOid
|
||||
}
|
||||
}
|
||||
|
||||
// Outputs
|
||||
output COMMUNICATION_CONNECTION_STRING string = listKeys(communicationService.id, apiVersion).primaryConnectionString
|
||||
output COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING string = listKeys(communicationService.id, apiVersion).primaryConnectionString
|
||||
output COMMUNICATION_SERVICE_ENDPOINT string = communicationService.properties.hostName
|
||||
output COMMUNICATION_SERVICE_ACCESS_KEY string = listKeys(communicationService.id, apiVersion).primaryKey
|
||||
output RESOURCE_GROUP_NAME string = resourceGroup().name
|
|
@ -1,86 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"baseName": {
|
||||
"type": "string",
|
||||
"defaultValue": "[resourceGroup().name]",
|
||||
"metadata": {
|
||||
"description": "The base resource name."
|
||||
}
|
||||
},
|
||||
"endpointPrefix": {
|
||||
"defaultValue": "communication",
|
||||
"type": "string"
|
||||
},
|
||||
"communicationServicesEndpointSuffix": {
|
||||
"defaultValue": ".communication.azure.com",
|
||||
"type": "string"
|
||||
},
|
||||
"testApplicationOid": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "The client OID to grant access to test resources."
|
||||
}
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "String",
|
||||
"metadata": {
|
||||
"description": "The tenant id to which the application and resources belong."
|
||||
}
|
||||
},
|
||||
"testApplicationId": {
|
||||
"type": "String",
|
||||
"metadata": {
|
||||
"description": "The application client id used to run tests."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"uniqueSubDomainName": "[format('{0}-{1}', parameters('baseName'), parameters('endpointPrefix'))]",
|
||||
"contributorRoleId": "b24988ac-6180-42a0-ab88-20f7382dd24c"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Communication/CommunicationServices",
|
||||
"apiVersion": "2023-03-31",
|
||||
"name": "[variables('uniqueSubDomainName')]",
|
||||
"location": "global",
|
||||
"properties": {
|
||||
"dataLocation": "UnitedStates"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Authorization/roleAssignments",
|
||||
"apiVersion": "2022-04-01",
|
||||
"name": "[guid(resourceGroup().id, deployment().name, parameters('baseName'), variables('contributorRoleId'))]",
|
||||
"properties": {
|
||||
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('contributorRoleId'))]",
|
||||
"principalId": "[parameters('testApplicationOid')]",
|
||||
"scope": "[resourceGroup().id]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"COMMUNICATION_CONNECTION_STRING": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2023-03-31').primaryConnectionString]"
|
||||
},
|
||||
"COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2023-03-31').primaryConnectionString]"
|
||||
},
|
||||
"COMMUNICATION_SERVICE_ENDPOINT": {
|
||||
"type": "string",
|
||||
"value": "[concat('https://', parameters('baseName'), '-', parameters('endpointPrefix'), parameters('communicationServicesEndpointSuffix'))]"
|
||||
},
|
||||
"COMMUNICATION_SERVICE_ACCESS_KEY": {
|
||||
"type": "string",
|
||||
"value": "[listKeys(resourceId('Microsoft.Communication/CommunicationServices',variables('uniqueSubDomainName')), '2023-03-31').primaryKey]"
|
||||
},
|
||||
"RESOURCE_GROUP_NAME": {
|
||||
"type": "string",
|
||||
"value": "[resourceGroup().Name]"
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче