SlideShare a Scribd company logo
1 of 10
Powershell, AzureRM, Subscribtion, Connect, Login, Resource Group, Billings, Tag, Active Directory
Active Directory, Role Based Access Control
Storage, SQL Database, App Service, Content Delivery Network, Key Vault
Redis Cache, Service Bus, Event Hub, Event Grid, Media Services, Logic Apps, Stream Analytics, IoT Hub
Virtual Network, Subnet, Network Gateway, Express Route, Network Security Group, Virtual Machine, DiSK
Virtual Machine Extension, Scale Set, VHD
Load balancer, Monitor, Data Store, Lake, Analytics
Traffic Manager
Power BI, Automation
Powershell, AzureRM, Subscribtion, Connect, Login, Resource Group, Billings, Tag, Active Directory
#Powershell Installation
Get-Module -Name PowerShellGet -ListAvailable | Select-Object -Property Name,Version,Path
Install-Module PowerShellGet –Force
#Azure Resource Manager Installation
Install-Module -Name AzureRM -AllowClobber
Get-Module AzureRM -ListAvailable | Select-Object -Property Name,Version,Path
#Subscribtion
New-AzureRmSubscription -Name "My Subscription" -EnrollmentAccountObjectId (Get-AzureRmEnrollmentAccount)[0].ObjectId) -OfferType MS-AZR-0017P
#Login Microsoft Account
Connect-AzureRmAccount
Disconnect-AzureRmAccount
#Login AD Account
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
$accountName ="testuser@netsoftsol.onmicrosoft.com"
$password = ConvertTo-SecureString "PassWord@2018" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($accountName, $password)
Login-AzureRmAccount -Credential $cred
Get-History | Export-CSV C:UsersCommandHistory.CSV
Get-History | Set-Content C:UsersCommandHistory.ps1
Get-Command Connect-AzureRmAccount
Get-AzureRmContext
#Resources
New-AzureRmResourceGroup -Name $resourceGroup -Location $location
#Billing
Get-AzureRmBillingPeriod -Name 201704-1
Get-AzureRmBillingInvoice -Name 2017-02-18-432543543
Get-AzureRmBillingInvoice -Latest
Get-AzureRmConsumptionBudget -ResourceGroupName RGBudgets -Name PSBudgetRG
#Tag
New-AzureRmTag -Name "Department" -Value "Finance"
Get-AzureRmTag
Get-AzureRmTag -Name "Department"
Get-AzureRmTag -Detailed
Remove-AzureRmTag -Name "Department" -Value "HumanResources" –PassThru
#Active Directory - Create new AAD application, group, user
New-AzureRmADApplication -DisplayName "NewApplication" -HomePage "http://www.microsoft.com" -IdentifierUris http://NewApplication
New-AzureRmADGroup -DisplayName "MyGroupDisplayName" -MailNickname myemail@domain.com
Add-AzureRmADGroupMember -MemberObjectId D9076BBC-D62C-4105-9C78-A7F5BC4A3405 -TargetGroupObjectId 85F89C90-780E-4AA6-9F4F-6F268D322EEE
$SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
New-AzureRmADApplication -DisplayName "NewApplication" -HomePage "http://www.microsoft.com" -IdentifierUris "http://NewApplication" -Password $SecureStringPassword
$SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
New-AzureRmADUser -DisplayName "MyDisplayName" -UserPrincipalName "myemail@domain.com" -Password $SecureStringPassword
$SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
New-AzureRmADSpCredential -ObjectId 1f99cf81-0146-4f4e-beae-2007d0668476 -Password $SecureStringPassword
Active Directory, Role Based Access Control
#Service Principal
New-AzureRmADServicePrincipal -Role Reader
New-AzureRmADServicePrincipal -Scope /subscriptions/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz/resourceGroups/myResourceGroup
New-AzureRmADServicePrincipal -ApplicationId 34a28ad2-dec4-4a41-bc3b-d22ddf90000e
$SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force
New-AzureRmADServicePrincipal -DisplayName SPForNoApp -Password $SecureStringPassword
Get-AzureRmADApplication -ObjectId 3ede3c26-b443-4e0b-9efc-b05e68338dc3 | New-AzureRmADServicePrincipal
#Create Role
$role = Get-AzureRmRoleDefinition "Virtual Machine Contributor"
$role.Id = $null
$role.Name = "Virtual Machine Operator"
$role.Description = "Can monitor and restart virtual machines."
$role.Actions.Clear()
$role.Actions.Add("Microsoft.Storage/*/read")
$role.Actions.Add("Microsoft.Network/*/read")
$role.Actions.Add("Microsoft.Compute/*/read")
$role.Actions.Add("Microsoft.Compute/virtualMachines/start/action")
$role.Actions.Add("Microsoft.Compute/virtualMachines/restart/action")
$role.Actions.Add("Microsoft.Authorization/*/read")
$role.Actions.Add("Microsoft.Resources/subscriptions/resourceGroups/read")
$role.Actions.Add("Microsoft.Insights/alertRules/*")
$role.Actions.Add("Microsoft.Support/*")
$role.AssignableScopes.Clear()
$role.AssignableScopes.Add("/subscriptions/00000000-0000-0000-0000-000000000000")
$role.AssignableScopes.Add("/subscriptions/11111111-1111-1111-1111-111111111111")
New-AzureRmRoleDefinition -Role $role #Subscribtion
#Create Role JSON
{
"Name": "Custom Role 1",
"Id": null,
"IsCustom": true,
"Description": "Allows for read access to Azure storage and compute resources and access to support",
"Actions": [
"Microsoft.Compute/*/read",
"Microsoft.Storage/*/read",
"Microsoft.Support/*"
],
"NotActions": [
],
"AssignableScopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000",
"/subscriptions/11111111-1111-1111-1111-111111111111"
]
}
New-AzureRmRoleDefinition -InputFile "C:CustomRolescustomrole1.json"
GetAzureRmRoleDefinition | ft name
(Get-AzureRmRoleDefinition "Virtual Machine Contributor").actions
Get-AzureRmRoleAssignment -scope "/subscriptions/f0675ec9-480d-4c2a-982a-ed97983af390" | select displayname
New-AzureRmRoleAssignment -ObjectId "74b007ea-ab34-4209-981e-c538200fe251" RoleDefinitionName "Virtual Machine Contributor" -Scope "/subscriptions/f0675ec9-480d-4c2a-982a-ed97983"‑
Get-AzureRmADGroup -SearchString "Sales (Sample Group)"
New-AzureRmRoleAssignment -ObjectId "74b007ea-ab34-4209-981e-c538200fe251" RoleDefinitionName "Virtual Machine Contributor" -Scope "/subscriptions/f0675ec9-480d-4c2a-982a-ed97983"‑
Storage, SQL Database, App Service, Content Delivery Network, Key Vault
#Storage
New-AzureRmStorageAccount -Location Central-US -Name $storageaccount -ResourceGroupName $resourceGroup -SkuName Standard_GRS
$StorageAccountKey=Get-AzureRmStorageAccountKey -ResourceGroupName SampleGroup -name SampleStore
$ctx = New-AzureStorageContext -StorageAccountName $storageaccount -StorageAccountKey $StorageAccountKey.value[0]
New-AzureStorageContainer -Name $storagecontainer -Context $ctx -Permission Blob
#SQL
New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"
$serverDNSAlias = New-AzureRmSqlServerDnsAlias -ResourceGroupName rg -ServerName serverName -DnsAliasName aliasName
New-AzureRmSqlElasticPool -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ElasticPoolName "ElasticPool01" -Edition "Standard" -Dtu 400 -DatabaseDtuMin 10 -DatabaseDtuMax 100
New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01" -ElasticPoolName "ElasticPool01"
New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database03" -Edition "GeneralPurpose" -Vcore 2 -ComputeGeneration "Gen4“
#App Service
New-AzureRmAppServicePlan -ResourceGroupName "Default-Web-WestUS" -Name "ContosoASP" -Location "West US" -Tier "Basic" -NumberofWorkers 2 -WorkerSize "Small"
New-AzureRmWebApp -ResourceGroupName Default-Web-WestUS -Name "ContosoSite" -Location "West US" -AppServicePlan "ContosoServicePlan"
New-AzureRmWebAppSSLBinding -ResourceGroupName "ContosoResourceGroup" -WebAppName "ContosoWebApp" -Thumbprint "E3A38EBA60CAA1C162785A2199C3" -Name www.contoso.com
New-AzureRmWebAppBackup -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -StorageAccountUrl "https://storageaccount.file.core.windows.net"
New-AzureRmWebAppDatabaseBackupSetting -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -ConnectionString "MyConnectionString" -DatabaseType "SqlAzure"
New-AzureRmWebAppSlot -ResourceGroupName Default-Web-WestUS -Name "ContosoSite" -AppServicePlan "ContosoServicePlan" -Slot "Slot001“
Set-AzureRmWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -HttpLoggingEnabled $true
Restore-AzureRmWebAppBackup -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -StorageAccountUrl "https://storageaccount.file.core.windows.net" -BlobName "myBlob"
Restart-AzureRmWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoSite"
Start-AzureRmWebAppSlot -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -Slot "Slot001" --- Stop, Remove, Get
Switch-AzureRmWebAppSlot -SourceSlotName "sourceslot" -DestinationSlotName "destinationslot" -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp“
#CDN
New-AzureRmCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Sku StandardAkamai -Location "Central US"
New-AzureRmCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Location "Central US" -EndpointName cdn1 -OriginName "Contoso" -OriginHostName "www.contoso.com"
$endpoint = Get-AzureRmCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -EndpointName cdnposhdoc
$endpoint.IsCompressionEnabled = $true
$endpoint.ContentTypesToCompress = "text/javascript","text/css","application/json"
Set-AzureRmCdnEndpoint -CdnEndpoint $endpoint
Unpublish-AzureRmCdnEndpointContent -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo -PurgeContent "/images/kitten.png","/video/rickroll.mp4"
Publish-AzureRmCdnEndpointContent -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo -LoadContent "/images/kitten.png","/video/rickroll.mp4"
Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Unpublish-AzureRmCdnEndpointContent -PurgeContent "/images/*"
Stop-AzureRmCdnEndpoint -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo
Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Stop-AzureRmCdnEndpoint
Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Start-AzureRmCdnEndpoint
Remove-AzureRmCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -EndpointName cdnposhdoc
Get-AzureRmCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG | Get-AzureRmCdnEndpoint | Remove-AzureRmCdnEndpoint -Force
Remove-AzureRmCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG
#Key Vault
New-AzureRmKeyVault -VaultName 'Contoso03Vault' -ResourceGroupName 'Group14' -Location 'East US' -Sku 'Premium‘
$Policy = New-AzureKeyVaultCertificatePolicy -SecretContentType "application/x-pkcs12" -SubjectName "CN=contoso.com" -IssuerName "Self" -ValidityInMonths 6 -ReuseKeyOnRenewal
Add-AzureKeyVaultCertificate -VaultName "ContosoKV01" -Name "TestCert01" -CertificatePolicy $Policy
Add-AzureKeyVaultCertificateContact -VaultName "ContosoKV01" -EmailAddress "patti.fuller@contoso.com" –PassThru
Add-AzureKeyVaultKey -VaultName 'contoso' -Name 'ITSoftware' -Destination 'Software'
Add-AzureKeyVaultKey -VaultName 'contoso' -Name 'ITHsm' -Destination 'HSM‘
$Password = ConvertTo-SecureString -String "123" -AsPlainText -Force
Import-AzureKeyVaultCertificate -VaultName "ContosoKV01" -Name "ImportCert01" -FilePath "C:UserscontosoUserDesktopimport.pfx" -Password $Password
Undo-AzureKeyVaultSecretRemoval -VaultName 'MyKeyVault' -Name 'MySecret'
Stop-AzureKeyVaultCertificateOperation -VaultName "Contoso01" -Name "TestCert02" -Force
Backup-AzureKeyVaultCertificate -VaultName 'mykeyvault' -Name 'mycert'
Backup-AzureKeyVaultKey -VaultName 'MyKeyVault' -Name 'MyCert' -OutputFile 'C:Backup.blob'
Redis Cache, Service Bus, Event Hub, Event Grid, Media Services, Logic Apps, Stream Analytics, IoT Hub
#Redis Cache
Get-AzureRmRedisCache -Name "myexists“
New-AzureRmRedisCache -ResourceGroupName $resourceGroup -Name $RedisCacheName -Location $location -Sku Basic -Size 250MB
New-AzureRmRedisCache -ResourceGroupName "MyGroup" -Name "MyCache" -Location "North Central US"
New-AzureRmRedisCache -ResourceGroupName "MyGroup" -Name “mc1" -Location "North Central US" -Size 250MB -Sku "Standard" -RedisConfiguration @{"maxmemory-policy" = "allkeys-random"} -Force
New-AzureRmRedisCacheFirewallRule -Name "mycache" -RuleName "ruleone" -StartIP "10.0.0.1" -EndIP "10.0.0.32"
New-AzureRmRedisCacheKey -ResourceGroupName "ResourceGroup03" -Name "myCache" -KeyType "Primary" -Force
New-AzureRmRedisCacheKey -ResourceGroupName "ResourceGroup03" -Name "myCache" -KeyType "Secondary" -Force
Import-AzureRmRedisCache -ResourceGroupName "ResourceGroup13" -Name "RedisCache06" -Files @("https://mystorageaccount.blob.core.windows.net/container22/blobname?sv=2015-04-
05&sr=b&sig=caIwutG2uDa0NZ8mjdNJdgOY8%2F8mhwRuGNdICU%2B0pI4%3D&st=2016-05-27T00%3A00%3A00Z&se=2016-05-28T00%3A00%3A00Z&sp=rwd") -Force
Export-AzureRmRedisCache -ResourceGroupName "ResourceGroup13" -Name "RedisCache06" -Prefix "blobprefix" -Container "https://mystorageaccount.blob.core.windows.net/container18?sv=2015-04-
05&sr=c&sig=HezZtBZ3DURmEGDduauE7pvETY4kqlPI8JCNa8ATmaw%3D&st=2016-05-27T00%3A00%3A00Z&se=2016-05-28T00%3A00%3A00Z&sp=rwdl"
#Service Bus
New-AzureRmServiceBusNamespace -Location $location -Name $ServiceBusname -ResourceGroupName $resourceGroup -SkuName Basic
$CurrentNamespace = Get-AzureRMServiceBusNamespace -ResourceGroup $resourceGroup -NamespaceName $ServiceBusname
New-AzureRmServiceBusQueue -Name $servicebusQueue -Namespace $ServiceBusname -ResourceGroupName $resourceGroup -MaxSizeInMegabytes 1024
New-AzureRmServiceBusAuthorizationRule -Name $servicebusrule -Namespace $ServiceBusname -Queue $servicebusQueue -ResourceGroupName $resourceGroup -Rights Send,listen,manage
#Event Hub
New-AzureRmEventHub -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Location WestUS -EventHubName MyEveNme -MessageRetentionInDays 3 -PartitionCount 2
New-AzureRmEventHubNamespace -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Location MyLocation
New-AzureRmEventHubNamespace -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Location MyLocation -EnableAutoInflate -MaximumThroughputUnits 10
#Event Grid
$includedEventTypes = "Microsoft.Resources.ResourceWriteFailure", "Microsoft.Resources.ResourceWriteSuccess"
$labels = "Finance", "HR"
New-AzureRmEventGridSubscription -Endpoint https://requestb.in/19qlscd1 -EventSubscriptionName ESub1 -SubjectBeginsWith "TestPrefix" -SubjectEndsWith "TestSuffix" -IncludedEventType
$includedEventTypes -Label $labels
New-AzureRmEventGridTopic -ResourceGroupName MyResourceGroupName -Name Topic1 -Location westus2 -Tag @{ Department="Finance"; Environment="Test" }
New-AzureRmEventGridTopicKey -ResourceGroup MyResourceGroupName -TopicName Topic1 -KeyName key1
#Logic Apps
$Workflow = Get-AzureRmLogicApp -ResourceGroupName "ResourceGroup11" -Name "LogicApp03"
New-AzureRmLogicApp -ResourceGroupName "ResourceGroup11" -Name "LogicApp13" -State "Enabled" -AppServicePlan "SePlan01" -Definition $Workflow.Definition -Parameters $Workflow.Parameters
#Media Services
New-AzureRmMediaService -ResourceGroupName $ResourceGroupName -AccountName $MediaServiceName -Location $Location -StorageAccountId $StorageAccount.Id -Tags $Tags
#Stream Analytics
New-AzureRmStreamAnalyticsJob -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:JobDefinition.json“
New-AzureRmStreamAnalyticsJob -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:JobDefinition.json" -Name "StreamingJob" –Force
New-AzureRmStreamAnalyticsInput -ResourceGroupName "StreamAnalytics-Default-West-US" -JobName "StreamingJob" -File "C:Input.json" -Name "EntryStream“
New-AzureRmStreamAnalyticsOutput -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:Output.json" -JobName "StreamingJob" -Name "Output“
#IoT Hub
New-AzureRmIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName "S1" -Units 1 -Location "northeurope" -Properties $properties
New-AzureRmIotHubExportDevices -ResourceGroupName "myresourcegroup" -Name "myiothub" -ExportBlobContainerUri "https://mystorageaccount.blob.core.windows.net/?sv=2015-04-
05&ss=bfqt&sr=c&srt=sco&sp=rwdl&se=2016-10-27T04:01:48Z&st=2016-10-26T20:01:48Z&spr=https&sig=QqpIhHsIMF8hNuFO%3D" -ExcludeKeys $true
New-AzureRmIotHubImportDevices -ResourceGroupName "myresourcegroup" -Name "myiothub" -InputBlobContainerUri "https://mystorageaccount.blob.core.windows.net/?sv=2015-04-
05&ss=bfqt&sr=c&srt=sco&sp=rwdl&se=2016-10-27T04:01:48Z&st=2016-10-26T20:01:48Z&spr=https&sig=QqpIhHsIMF8hNuFO%3D" -OutputBlobContainerUri
"https://mystorageaccount.blob.core.windows.net/?sv=2015-04-05&ss=bfqt&sr=c&srt=sco&sp=rwdl&se=2016-10-27T04:01:48Z&st=2016-10-26T20:01:48Z&spr=https&sig=QqpIhHsIMF8hNuFO%3D"
Set-AzureRmIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -EventHubRetentionTimeInDays 4
Set-AzureRmIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName S1 -Units 5
Add-AzureRmIotHubCertificate -ResourceGroupName "myresourcegroup" -Name "myiothub" -CertificateName "mycertificate" -Path "c:mycertificate.cer" -Etag "AAAAAAFPazE="
Virtual Network, Subnet, Network Gateway, Express Route, Network Security Group, Virtual Machine, DiSK
#Virtual Network
$subnetConfig1= New-AzureRmVirtualNetworkSubnetConfig -Name publicSubnet -AddressPrefix 192.168.0.0/24 -ServiceEndpoint Microsoft.sql
$vnetName = "BridgelabzVnet"
$vnet = New-AzureRmVirtualNetwork -ResourceGroupName $resourceGroup -Location $location -Name $vnetName -AddressPrefix 192.168.0.0/16 -Subnet $subnetConfig1
#Network Gateway
New-AzureRmLocalNetworkGateway -Name Site1 -ResourceGroupName TestRG1 ` -Location 'East US' -GatewayIpAddress '23.99.221.164' -AddressPrefix '10.101.0.0/24‘
$gw = Get-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG
Resize-AzureRmVirtualNetworkGateway -VirtualNetworkGateway $gw -GatewaySku HighPerformance
Remove-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG
New-AzureRmVirtualNetworkGatewayConnection -Name $Connection41 -ResourceGroupName $RG4 ` -VirtualNetworkGateway1 $vnet4gw -VirtualNetworkGateway2 $vnet1gw -Location $Location4 `
-ConnectionType Vnet2Vnet -SharedKey 'AzureA1b2C3‘
#Express Route
$circuit = Get-AzureRmExpressRouteCircuit -Name "MyCircuit" -ResourceGroupName "MyRG"
$gw = Get-AzureRmVirtualNetworkGateway -Name "ExpressRouteGw" -ResourceGroupName "MyRG"
$connection = New-AzureRmVirtualNetworkGatewayConnection -Name "ERConnection" -ResourceGroupName "MyRG" -Location "East US" -VirtualNetworkGateway1 $gw -PeerId $circuit.Id
-ConnectionType ExpressRoute
New-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup" -Location "West US" -SkuTier Standard -SkuFamily MeteredData
-ServiceProviderName "Equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 200
Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup“
$ckt = Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup"
$ckt.ServiceProviderProperties.BandwidthInMbps = 1000
$ckt.Sku.Family = "UnlimitedData"
$ckt.sku.Name = "Premium_UnlimitedData"
Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt
Remove-AzureRmExpressRouteCircuit -ResourceGroupName "ExpressRouteResourceGroup" -Name "ExpressRouteARMCircuit"
#Network Security Group, Interface
$rule1 = New-AzureRmNetworkSecurityRuleConfig -Name rdp-rule -Description "Allow RDP" -Access Allow -Protocol Tcp -Direction Inbound -Priority 100 `
-SourceAddressPrefix Internet -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389
$nsgapp = New-AzureRmNetworkSecurityGroup -ResourceGroupName $resourceGroup -Location $location -Name appnsg -SecurityRules $rule1
$nic1=New-AzureRmNetworkInterface -ResourceGroupName $resourceGroup -Location $location -Name appNic -Subnet $vnet.Subnets[0] -NetworkSecurityGroup $nsgapp
-LoadBalancerBackendAddressPool $apppool -LoadBalancerInboundNatRule $appinboundNATRule
#Virtual Machine
$appvmConfig = New-AzureRmVMConfig -VMName $vmName1 -VMSize Standard_B2s -AvailabilitySetId $appset.Id | `
Set-AzureRmVMOperatingSystem -Windows -ComputerName $vmName1 -Credential $cred | `
Set-AzureRmVMSourceImage -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2016-Datacenter -Version latest | `
Add-AzureRmVMNetworkInterface -Id $nic1.Id
New-AzureRmVM -ResourceGroupName $resourceGroup -Location $location -VM $appvmConfig
New-AzureRmVm -ResourceGroupName "myResourceGroupAutomate" -Name "myVM" -Location "East US" -VirtualNetworkName "myVnet" -SubnetName "mySubnet" -SecurityGroupName
"myNetworkSecurityGroup" -PublicIpAddressName "myPublicIpAddress" -OpenPorts 80 -Credential $cred
Start-AzureRmVm -ResourceGroupName $resgroupname -Name $vmname
Stop-AzureRmVm -ResourceGroupName $resgroupname -Name $vmname -Force
Get-AzureRmPublicIPAddress -ResourceGroupName "myResourceGroupAutomate" -Name "myPublicIPAddress" | select IpAddress
#Disk
$rgName = 'myResourceGroup‘ | $vmName = 'myVM‘ | $location = 'East US' | $storageType = 'Premium_LRS‘ | $dataDiskName = $vmName + '_datadisk1‘
$diskConfig = New-AzureRmDiskConfig -SkuName $storageType -Location $location -CreateOption Empty -DiskSizeGB 128
$dataDisk1 = New-AzureRmDisk -DiskName $dataDiskName -Disk $diskConfig -ResourceGroupName $rgName
$vm = Get-AzureRmVM -Name $vmName -ResourceGroupName $rgName
$vm = Add-AzureRmVMDataDisk -VM $vm -Name $dataDiskName -CreateOption Attach -ManagedDiskId $dataDisk1.Id -Lun 1
Update-AzureRmVM -VM $vm -ResourceGroupName $rgName
$VirtualMachine = Get-AzureRmVM -ResourceGroupName "RG11" -Name "MyVM07"
Remove-AzureRmVMDataDisk -VM $VirtualMachine -Name "DataDisk3"
Update-AzureRmVM -ResourceGroupName "RG11" -VM $VirtualMachine
Virtual Machine Extension, Scale Set, VHD
#Virtual Machine Extension
Set-AzureRmVMExtension -ResourceGroupName "myResourceGroupAutomate" -ExtensionName "IIS" -VMName "myVM" -Location "EastUS" `
-Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHandlerVersion 1.8 `
-SettingString '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path "C:inetpubwwwrootDefault.htm" -Value $($env:computername)"}‘
Set-AzureRmVMCustomScriptExtension -ResourceGroupName $resourcegroup -VMName $vmName1 -Name "NotesCustomScript" -FileUri $appblobUrl -Run "NotesAPPVM.ps1" -Location $location
********NotesAPPVM.ps1
Add-WindowsFeature Web-Server -IncludeManagementTools -includeallsubfeature
Set-WebBinding -Name "Default Web Site" -BindingInformation "*:80:" -PropertyName Port -Value 1234
$rediskey='fundooredis.redis.cache.windows.net:6380,password=2TIr6mEkZwLJi+VmOT2NS+9u9UkHmjtVcN8KXK+LmzM=,ssl=True,abortConnect=False'
$servicebuskey='Endpoint=sb://fundoobus.servicebus.windows.net/;SharedAccessKeyName=ReminderPolicy;SharedAccessKey=XujChsUu789yJmF8T9OGgeEujIgMzwKT7ATDYbTjAbQ=;EntityPath=remi
nder‘
[Environment]::SetEnvironmentVariable("RedisCache",$rediskey , "Machine")
[Environment]::SetEnvironmentVariable("ServiceBus",$servicebuskey , "Machine")
*********************
#Virtual Machine Scale Set
New-AzureRmVmss -ResourceGroupName "myResourceGroupScaleSet" -Location "EastUS" -VMScaleSetName "myScaleSet" -VirtualNetworkName "myVnet" -SubnetName "mySubnet" `
-PublicIpAddressName "myPublicIPAddress" -LoadBalancerName "myLoadBalancer" -UpgradePolicy "Automatic“
$publicSettings = @{
"fileUris" = (,"https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/automate-iis.ps1");
"commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File automate-iis.ps1"
}
$vmss = Get-AzureRmVmss -ResourceGroupName "myResourceGroupScaleSet" -VMScaleSetName "myScaleSet“
Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name "customScript" -Publisher "Microsoft.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion 1.8 -Setting $publicSettings
Update-AzureRmVmss -ResourceGroupName "myResourceGroupScaleSet" -Name "myScaleSet" -VirtualMachineScaleSet $vmss
Get-AzureRmVmssVM -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0“
$vmss = Get-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet“
$vmss.sku.capacity = 5
Update-AzureRmVmss -ResourceGroupName "myResourceGroup" -Name "myScaleSet" -VirtualMachineScaleSet $vmss
Get-AzureRmVmssVM -ResourceGroupName "myResourceGroupScaleSet" -VMScaleSetName "myScaleSet“
Get-AzureRmVmssVM -ResourceGroupName "myResourceGroupScaleSet" -VMScaleSetName "myScaleSet" -InstanceId "1"
Start-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0"
Stop-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0“
#Scale Down Rule
$myScaleProfile = New-AzureRmAutoscaleProfile -DefaultCapacity 2 -MaximumCapacity 10 -MinimumCapacity 2 -Rules $myRuleScaleUp,$myRuleScaleDown -Name "autoprofile"
Add-AzureRmAutoscaleSetting -Location $myLocation -Name "autosetting" -ResourceGroup $myResourceGroup -TargetResourceId $myScaleSetId -AutoscaleProfiles $myScaleProfile
Restart-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0"
Remove-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0“
#VHD
Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd"
Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -Overwrite
Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -NumberOfUploaderThreads 32
Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd?st=2013-01 -09T22%3A15%3A49Z&se=2013-01-
09T23%3A10%3A49Z&sr=b&sp=w&sig=13T9Ow%2FRJAMmhfO%2FaP3HhKKJ6AY093SmveO SIV4%2FR7w%3D" -LocalFilePath "C:vhdwin7baseimage.vhd“
ConvertTo-AzureRmVhd -HyperVVMName 'test' -ExportPath '.'; .testVirtual Hard DisksConvertedos.vhd .testVirtual Hard DisksConverteddisk.vhd
Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -ResourceGroupName "rgname"
Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -Overwrite -ResourceGroupName "rgname"
Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -NumberOfThreads 32 -ResourceGroupName
"rgname"
Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -StorageKey
"zNvcH0r5vAGmC5AbwEtpcyWCMyBd3eMDbdaa4ua6kwxq6vTZH3Y+sw==" -ResourceGroupName "rgname"
Traffic Manager
#Traffic Manager
$profiles = Get-AzureTrafficManagerProfile
$profiles | Format-Table
$profile = Get-AzureTrafficManagerProfile -Name "MyProfile"
$profile | Format-List
$profile.Endpoints | Format-
$profile = New-AzureTrafficManagerProfile -Name "MyProfile" -DomainName "myprofile.trafficmanager.net" -LoadBalancingMethod "RoundRobin" -Ttl 30 -MonitorProtocol "Http" -MonitorPort 80
-MonitorRelativePath "/"
$profile = Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "myapp-eu.cloudapp.net" -Status "Enabled" -Type "CloudService"
$profile = Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "myapp-us.cloudapp.net" -Status "Enabled" -Type "CloudService"
Set-AzureTrafficManagerProfile –TrafficManagerProfile $profile
New-AzureTrafficManagerProfile -Name "MyProfile" -DomainName "myprofile.trafficmanager.net" -LoadBalancingMethod "RoundRobin" -Ttl 30 -MonitorProtocol "Http" -MonitorPort 80
-MonitorRelativePath "/" | Add-AzureTrafficManagerEndpoint -DomainName "myapp-eu.cloudapp.net" -Status "Enabled" -Type "CloudService" | Add-AzureTrafficManagerEndpoint -DomainName
"myapp-us.cloudapp.net" -Status "Enabled" -Type "CloudService" | Set-AzureTrafficManagerProfile
New-AzureRmTrafficManagerEndpoint -Name eu-endpoint -ProfileName MyProfile -ResourceGroupName MyRG -Type ExternalEndpoints -Target app-eu.contoso.com -EndpointStatus Enabled
$child = New-AzureRmTrafficManagerProfile -Name child -ResourceGroupName MyRG -TrafficRoutingMethod Priority -RelativeDnsName child -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80
-MonitorPath "/"
$parent = New-AzureRmTrafficManagerProfile -Name parent -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName parent -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80
-MonitorPath "/"
Add-AzureRmTrafficManagerEndpointConfig -EndpointName child-endpoint -TrafficManagerProfile $parent -Type NestedEndpoints -TargetResourceId $child.Id -EndpointStatus Enabled
-EndpointLocation "North Europe" -MinChildEndpoints 2
Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile
$child = Get-AzureRmTrafficManagerEndpoint -Name child -ResourceGroupName MyRG
New-AzureRmTrafficManagerEndpoint -Name child-endpoint -ProfileName parent -ResourceGroupName MyRG -Type NestedEndpoints -TargetResourceId $child.Id -EndpointStatus Enabled
-EndpointLocation "North Europe" -MinChildEndpoints 2
Set-AzureRmContext -SubscriptionId $EndpointSubscription
$ip = Get-AzureRmPublicIpAddress -Name $IpAddresName -ResourceGroupName $EndpointRG
Set-AzureRmContext -SubscriptionId $trafficmanagerSubscription
New-AzureRmTrafficManagerEndpoint -Name $EndpointName -ProfileName $ProfileName -ResourceGroupName $TrafficManagerRG -Type AzureEndpoints -TargetResourceId $ip.Id -EndpointStatus
Enabled
$profile = New-AzureRmTrafficManagerProfile -Name FundooTraffic -ResourceGroupName $resourcegroup -TrafficRoutingMethod Performance -RelativeDnsName fundootraffic -Ttl 30
-MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/"
$applb = Get-AzureRmPublicIpAddress -Name applbip -ResourceGroupName $resourcegroup
Add-AzureRmTrafficManagerEndpointConfig -EndpointName applbEndpoint -TrafficManagerProfile $profile -Type AzureEndpoints -TargetResourceId $applb.Id -EndpointStatus Enabled
Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile
#Update Endpoints
$profile = Get-AzureTrafficManagerProfile -Name "MyProfile"
$profile.MonitorRelativePath = "/monitor.aspx"
Set-AzureTrafficManagerProfile –TrafficManagerProfile $profile
$endpoint = Get-AzureRmTrafficManagerEndpoint -Name myendpoint -ProfileName myprofile -ResourceGroupName MyRG -Type ExternalEndpoints
$endpoint.Weight = 20
Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $endpoint
$profile = Get-AzureRmTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG
$profile.Endpoints[0].Priority = 2
$profile.Endpoints[1].Priority = 1
Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile
Disable-AzureTrafficManagerProfile -Name "MyProfile"
Enable-AzureTrafficManagerProfile -Name "MyProfile“
Remove-AzureTrafficManagerProfile -Name "MyProfile" -Force
Load balancer, Monitor, Data Store, Lake, Analytics
#Load Balancer
#Public Load Balancer
$APPLBIP = New-AzureRmPublicIpAddress -Name applbip -ResourceGroupName $resourceGroup -Location $location -AllocationMethod Static -DomainNameLabel $DomainNameLabel
$appfrontendIP = New-AzureRmLoadBalancerFrontendIpConfig -Name APP-LB-Frontend -PublicIpAddress $APPLBIP
$apppool = New-AzureRmLoadBalancerBackendAddressPoolConfig -Name APP-LB-backend
$appinboundNATRule= New-AzureRmLoadBalancerInboundNatRuleConfig -Name APPRDP -FrontendIpConfiguration $appfrontendIP -Protocol TCP -FrontendPort 3441 -BackendPort 3389
$apphealthProbe = New-AzureRmLoadBalancerProbeConfig -Name APPHealthProbe -RequestPath / -Protocol http -Port 80 -IntervalInSeconds 15 -ProbeCount 2
$applbrule = New-AzureRmLoadBalancerRuleConfig -Name APPHTTP -FrontendIpConfiguration $appfrontendIP -BackendAddressPool $appPool -Probe $apphealthProbe -Protocol Tcp -FrontendPort 80
-BackendPort 80
$APPLB = New-AzureRmLoadBalancer -ResourceGroupName $resourceGroup -Name applb -Location $location -FrontendIpConfiguration $appfrontendIP -InboundNatRule $appinboundNATRule
-LoadBalancingRule $applbrule -BackendAddressPool $appPool -Probe $apphealthProbe
#Private Load Balancer
$apifrontendIP = New-AzureRmLoadBalancerFrontendIpConfig -Name API-LB-Frontend -PrivateIpAddress 192.168.0.110 -SubnetId $vnet.subnets[0].Id
$apipool= New-AzureRmLoadBalancerBackendAddressPoolConfig -Name API-LB-backend
$apiinboundNATRule= New-AzureRmLoadBalancerInboundNatRuleConfig -Name "RDP1" -FrontendIpConfiguration $apifrontendIP -Protocol TCP -FrontendPort 3442 -BackendPort 3389
$apihealthProbe= New-AzureRmLoadBalancerProbeConfig -Name "APIHealthProbe" -RequestPath / -Protocol http -Port 80 -IntervalInSeconds 15 -ProbeCount 2
$apilbrule = New-AzureRmLoadBalancerRuleConfig -Name "APIHTTP" -FrontendIpConfiguration $apifrontendIP -BackendAddressPool $apiPool -Probe $apihealthProbe -Protocol Tcp -FrontendPort 80
-BackendPort 80
$APILB = New-AzureRmLoadBalancer -ResourceGroupName $resourceGroup -Name apilb -Location $location -FrontendIpConfiguration $apifrontendIP -InboundNatRule $apiinboundNATRule
-LoadBalancingRule $apilbrule -BackendAddressPool $apiPool -Probe $apihealthProbe
#Monitor
New-AzureRmApplicationInsights -Kind java -ResourceGroupName testgroup -Name test1027 -location eastus
New-AzureRmAutoscaleNotification -CustomEmails "pattif@contoso.com, davidchew@contoso.net"
#Create a profile with no schedule or fixed date
$Rule = New-AzureRmAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-
EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase
-ScaleActionScaleType ChangeCount -ScaleActionValue "1"
$Profile = New-AzureRmAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -Rules $Rule -Name "ProfileName“
New-AzureRmAlertRuleEmail -CustomEmails pattif@contoso.com,davidchew@contoso.net
Add-AzureRmMetricAlertRule -Name "metricRule5" -Location "East US" -ResourceGroup "Default-Web-EastUS" -Operator GreaterThan -Threshold 1 -TargetResourceId "/subscriptions/b93fb07a-6f93-
30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -MetricName "Requests" -TimeAggregationOperator Total
Add-AzureRmLogProfile -Locations "Global","West US" -Name ExportLogProfile -StorageAccountId /subscriptions/40gpe80s-9sb7-4f07-9042-
b1b6a92ja9fk/resourceGroups/activitylogRG/providers/Microsoft.Storage/storageAccounts/activitylogstorageaccount
Disable-AzureRmActivityLogAlert -Name "alert1" -ResourceGroupName "Default-ActivityLogsAlerts“
#Data Lake Analytics, Store, Lake
New-AzureRmDataLakeAnalyticsAccount -Name "ContosoAdlAccount" -ResourceGroupName "ContosoOrg" -Location "East US 2" -DefaultDataLakeStore "ContosoAdlStore"
New-AzureRmDataLakeAnalyticsCatalogCredential -AccountName "ContosoAdlAccount" -DatabaseName "databaseName" -CredentialName "exampleDbCred" -Credential (Get-Credential)
-DatabaseHost "example.contoso.com" -Port 8080
Add-AzureRmDataLakeAnalyticsDataSource -Account "ContosoAdlA" -DataLakeStore "ContosoAdlS"
Set-AzureRmDataLakeAnalyticsDataSource -Account "ContosoAdlAccount" -Blob "contosowasb" -AccessKey "...newaccesskey...“
New-AzureRmDataLakeStoreAccount -Name "ContosoADL" -ResourceGroupName "ContosoOrg" -Location "East US 2"
New-AzureRmDataLakeStoreItem -AccountName "ContosoADL" -Path "/NewFile.txt"
New-AzureRmDataLakeStoreItem -AccountName "ContosoADL" -Path "/NewFolder" –Folder
Set-AzureRmDataLakeStoreItemExpiry -AccountName "ContosoADL" -Path /myfile.txt -Expiration [DateTimeOffset]::Now.AddHours(2)
Add-AzureRmDataLakeStoreItemContent -AccountName "ContosoADLS" -Path /abc/myFile.txt -Value "My content here“
New-AzureRmDmsConnInfo -ServerType SQL -DataSource mySourceServer -AuthType SqlAuthentication -TrustServerCertificate:$true
New-AzureRmDataMigrationDatabaseInfo -SourceDatabaseName 'AdventureWorks2016'
New-AzureRmDmsFileShare -Path $fileSharePath -Credential $fileShareCred
New-AzureRmDataMigrationProject -ResourceGroupName MyResourceGroup -ServiceName TestService -ProjectName MyDMSProject -Location "central us" -SourceType SQL -TargetType SQLDB
-SourceConnection $sourceConnInfo -TargetConnection $targetConnInfo -DatabaseInfo $dbList
New-AzureRmDataMigrationSelectedDB -MigrateSqlServerSqlDb -Name "HR" -TargetDatabaseName "HR_PSTEST" -TableMap $tableMap
New-AzureRmDataMigrationSelectedDB -MigrateSqlServerSqlDbMi -Name "HR" -TargetDatabaseName "HR_PSTEST" -BackupFileShare $backupFileShare
Power BI, Automation
#PowerBI
New-AzureRmPowerBIEmbeddedCapacity -ResourceGroupName "testRG" -Name "testcapacity" -Location "West Central US" -Sku "A1" -Administrator admin@microsoft.com
New-AzureRmPowerBIWorkspaceCollection -ResourceGroupName "ResourceGroup17" -WorkspaceCollectionName "WCN11" -Location "Japan West“
#Automation
New-AzureRmAutomationAccount -Name "ContosoAutomationAccount" -Location "East US" -ResourceGroupName "ResourceGroup01“
$FieldValues = @{"AutomationCertificateName"="ContosoCertificate";"SubscriptionID"="81b59010-dc55-45b7-89cd-5ca26db62472"}
New-AzureRmAutomationConnection -Name "Connection12" -ConnectionTypeName Azure -ConnectionFieldValues $FieldValues -ResourceGroupName "ResourceGroup01" -AutomationAccountName
"AutomationAccount01"
New-AzureRmAutomationModule -AutomationAccountName "Contoso17" -Name "ContosoModule" -ContentLink "http://contosostorage.blob.core.windows.net/modules/ContosoModule.zip"
-ResourceGroupName "ResourceGroup01“
New-AzureRmAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbook02" -ResourceGroupName "ResourceGroup01“
#Schedule
$ $TimeZone = ([System.TimeZoneInfo]::Local)Id
New-AzureRmAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule01" -StartTime "23:00" -OneTime -ResourceGroupName "ResourceGroup01" -TimeZone $TimeZone
#Schedule – Recurring
$StartTime = Get-Date "13:00:00"
$EndTime = $StartTime.AddYears(1)
New-AzureRmAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule02" -StartTime $StartTime -ExpiryTime $EndTime -DayInterval 1 -ResourceGroupName "ResourceGroup01“
#Backup
New-AzureRmBackupVault -ResourceGroupName "ResourceGroup02" -Name "Vault03" -Region "westus" -Storage LocallyRedundant
$Vault = Get-AzureRmBackupVault -Name "Vault03"
Register-AzureRmBackupContainer -Vault $Vault -Name "Contoso03Vm" -ServiceName "ContosoService27“
#Batch – Job
$PoolInformation = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSPoolInformation"
$PoolInformation.PoolId = "Pool22"
New-AzureBatchJob -Id "ContosoJob35" -PoolInformation $PoolInformation -BatchContext $Context
#Batch – Schedule
$Schedule = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSSchedule"
$Schedule.RecurrenceInterval = [TimeSpan]::FromDays(1)
$JobSpecification = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSJobSpecification"
$JobSpecification.PoolInformation = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSPoolInformation"
$JobSpecification.PoolInformation.PoolId = "ContosoPool06"
New-AzureBatchJobSchedule -Id "JobSchedule17" -Schedule $Schedule -JobSpecification $JobSpecification -BatchContext $Context

More Related Content

What's hot

Azure Resource Manager (ARM) Template - Beginner's Guide
Azure Resource Manager (ARM) Template - Beginner's GuideAzure Resource Manager (ARM) Template - Beginner's Guide
Azure Resource Manager (ARM) Template - Beginner's GuideJuv Chan
 
Inside Azure Resource Manager
Inside Azure Resource ManagerInside Azure Resource Manager
Inside Azure Resource ManagerMichael Collier
 
Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Thijs Feryn
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.jsAyush Mishra
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
Working with PowerVC via its REST APIs
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIsJoe Cropper
 
Servlets intro
Servlets introServlets intro
Servlets introvantinhkhuc
 
Lecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile DevicesLecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile DevicesMaksym Davydov
 
AWS May Webinar Series - Deep Dive: Infrastructure as Code
AWS May Webinar Series - Deep Dive: Infrastructure as CodeAWS May Webinar Series - Deep Dive: Infrastructure as Code
AWS May Webinar Series - Deep Dive: Infrastructure as CodeAmazon Web Services
 
Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Jim Manico
 
Stratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration PresentationStratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration PresentationJeremy Przygode
 
Java Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJava Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJoshua Long
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Jim Manico
 
스프링 시큐리티로 시작하는 웹 어플리케이션 보안
스프링 시큐리티로 시작하는 웹 어플리케이션 보안스프링 시큐리티로 시작하는 웹 어플리케이션 보안
스프링 시큐리티로 시작하는 웹 어플리케이션 보안HyungTae Lim
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesBrad Hill
 
Side by Side with Elasticsearch and Solr
Side by Side with Elasticsearch and SolrSide by Side with Elasticsearch and Solr
Side by Side with Elasticsearch and SolrSematext Group, Inc.
 
High availability solution database mirroring
High availability solution database mirroringHigh availability solution database mirroring
High availability solution database mirroringMustafa EL-Masry
 

What's hot (20)

Azure Resource Manager (ARM) Template - Beginner's Guide
Azure Resource Manager (ARM) Template - Beginner's GuideAzure Resource Manager (ARM) Template - Beginner's Guide
Azure Resource Manager (ARM) Template - Beginner's Guide
 
Parse Advanced
Parse AdvancedParse Advanced
Parse Advanced
 
Inside Azure Resource Manager
Inside Azure Resource ManagerInside Azure Resource Manager
Inside Azure Resource Manager
 
Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019Developing cacheable backend applications - Appdevcon 2019
Developing cacheable backend applications - Appdevcon 2019
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.js
 
Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
Working with PowerVC via its REST APIs
Working with PowerVC via its REST APIsWorking with PowerVC via its REST APIs
Working with PowerVC via its REST APIs
 
Servlets intro
Servlets introServlets intro
Servlets intro
 
Lecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile DevicesLecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile Devices
 
AWS May Webinar Series - Deep Dive: Infrastructure as Code
AWS May Webinar Series - Deep Dive: Infrastructure as CodeAWS May Webinar Series - Deep Dive: Infrastructure as Code
AWS May Webinar Series - Deep Dive: Infrastructure as Code
 
Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12Top Ten Web Application Defenses v12
Top Ten Web Application Defenses v12
 
Hadoop security
Hadoop securityHadoop security
Hadoop security
 
Stratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration PresentationStratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration Presentation
 
Java Configuration Deep Dive with Spring
Java Configuration Deep Dive with SpringJava Configuration Deep Dive with Spring
Java Configuration Deep Dive with Spring
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
 
스프링 시큐리티로 시작하는 웹 어플리케이션 보안
스프링 시큐리티로 시작하는 웹 어플리케이션 보안스프링 시큐리티로 시작하는 웹 어플리케이션 보안
스프링 시큐리티로 시작하는 웹 어플리케이션 보안
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
Side by Side with Elasticsearch and Solr
Side by Side with Elasticsearch and SolrSide by Side with Elasticsearch and Solr
Side by Side with Elasticsearch and Solr
 
High availability solution database mirroring
High availability solution database mirroringHigh availability solution database mirroring
High availability solution database mirroring
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
 

Similar to Azure Powershell Tips

Azure powershell management
Azure powershell managementAzure powershell management
Azure powershell managementChristian Toinard
 
Azure ARM Templates 101
Azure ARM Templates 101Azure ARM Templates 101
Azure ARM Templates 101Aaron Saikovski
 
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
Aprovisionamiento multi-proveedor con Terraform  - Plain Concepts DevOps dayAprovisionamiento multi-proveedor con Terraform  - Plain Concepts DevOps day
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps dayPlain Concepts
 
(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...
(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...
(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...Amazon Web Services
 
2013 05-openstack-israel-heat
2013 05-openstack-israel-heat2013 05-openstack-israel-heat
2013 05-openstack-israel-heatAlex Heneveld
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
 
Provisioning in Microsoft Azure
Provisioning in Microsoft AzureProvisioning in Microsoft Azure
Provisioning in Microsoft Azureilagin
 
My First Big Data Application
My First Big Data ApplicationMy First Big Data Application
My First Big Data ApplicationAmazon Web Services
 
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreScaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreDropsolid
 
2013 05-fite-club-working-models-cloud-growing-up
2013 05-fite-club-working-models-cloud-growing-up2013 05-fite-club-working-models-cloud-growing-up
2013 05-fite-club-working-models-cloud-growing-upAlex Heneveld
 
Charla - SharePoint en la Nube (17Jul2013)
Charla - SharePoint en la Nube (17Jul2013)Charla - SharePoint en la Nube (17Jul2013)
Charla - SharePoint en la Nube (17Jul2013)Juan AndrĂŠs Valenzuela
 
Introducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewIntroducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewCat Chen
 
Java clients for elasticsearch
Java clients for elasticsearchJava clients for elasticsearch
Java clients for elasticsearchFlorian Hopf
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)Pat Patterson
 
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...Amazon Web Services
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Amazon Web Services
 
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...MUG-Lyon Microsoft User Group
 
Playing with php_on_azure
Playing with php_on_azurePlaying with php_on_azure
Playing with php_on_azureCEDRIC DERUE
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Mohan Arumugam
 

Similar to Azure Powershell Tips (20)

Azure powershell management
Azure powershell managementAzure powershell management
Azure powershell management
 
Azure ARM Templates 101
Azure ARM Templates 101Azure ARM Templates 101
Azure ARM Templates 101
 
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
Aprovisionamiento multi-proveedor con Terraform  - Plain Concepts DevOps dayAprovisionamiento multi-proveedor con Terraform  - Plain Concepts DevOps day
Aprovisionamiento multi-proveedor con Terraform - Plain Concepts DevOps day
 
(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...
(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...
(SEC309) Amazon VPC Configuration: When Least Privilege Meets the Penetration...
 
Deploying SharePoint @ Cloud
Deploying SharePoint @ CloudDeploying SharePoint @ Cloud
Deploying SharePoint @ Cloud
 
2013 05-openstack-israel-heat
2013 05-openstack-israel-heat2013 05-openstack-israel-heat
2013 05-openstack-israel-heat
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
Provisioning in Microsoft Azure
Provisioning in Microsoft AzureProvisioning in Microsoft Azure
Provisioning in Microsoft Azure
 
My First Big Data Application
My First Big Data ApplicationMy First Big Data Application
My First Big Data Application
 
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and moreScaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
Scaling Drupal in AWS Using AutoScaling, Cloudformation, RDS and more
 
2013 05-fite-club-working-models-cloud-growing-up
2013 05-fite-club-working-models-cloud-growing-up2013 05-fite-club-working-models-cloud-growing-up
2013 05-fite-club-working-models-cloud-growing-up
 
Charla - SharePoint en la Nube (17Jul2013)
Charla - SharePoint en la Nube (17Jul2013)Charla - SharePoint en la Nube (17Jul2013)
Charla - SharePoint en la Nube (17Jul2013)
 
Introducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 PreviewIntroducing Asp.Net Ajax 4.0 Preview
Introducing Asp.Net Ajax 4.0 Preview
 
Java clients for elasticsearch
Java clients for elasticsearchJava clients for elasticsearch
Java clients for elasticsearch
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
(BAC404) Deploying High Availability and Disaster Recovery Architectures with...
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
 
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
 
Playing with php_on_azure
Playing with php_on_azurePlaying with php_on_azure
Playing with php_on_azure
 
Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013Power Shell and Sharepoint 2013
Power Shell and Sharepoint 2013
 

Recently uploaded

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂşjo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Azure Powershell Tips

  • 1. Powershell, AzureRM, Subscribtion, Connect, Login, Resource Group, Billings, Tag, Active Directory Active Directory, Role Based Access Control Storage, SQL Database, App Service, Content Delivery Network, Key Vault Redis Cache, Service Bus, Event Hub, Event Grid, Media Services, Logic Apps, Stream Analytics, IoT Hub Virtual Network, Subnet, Network Gateway, Express Route, Network Security Group, Virtual Machine, DiSK Virtual Machine Extension, Scale Set, VHD Load balancer, Monitor, Data Store, Lake, Analytics Traffic Manager Power BI, Automation
  • 2. Powershell, AzureRM, Subscribtion, Connect, Login, Resource Group, Billings, Tag, Active Directory #Powershell Installation Get-Module -Name PowerShellGet -ListAvailable | Select-Object -Property Name,Version,Path Install-Module PowerShellGet –Force #Azure Resource Manager Installation Install-Module -Name AzureRM -AllowClobber Get-Module AzureRM -ListAvailable | Select-Object -Property Name,Version,Path #Subscribtion New-AzureRmSubscription -Name "My Subscription" -EnrollmentAccountObjectId (Get-AzureRmEnrollmentAccount)[0].ObjectId) -OfferType MS-AZR-0017P #Login Microsoft Account Connect-AzureRmAccount Disconnect-AzureRmAccount #Login AD Account Set-ExecutionPolicy -ExecutionPolicy RemoteSigned $accountName ="testuser@netsoftsol.onmicrosoft.com" $password = ConvertTo-SecureString "PassWord@2018" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential($accountName, $password) Login-AzureRmAccount -Credential $cred Get-History | Export-CSV C:UsersCommandHistory.CSV Get-History | Set-Content C:UsersCommandHistory.ps1 Get-Command Connect-AzureRmAccount Get-AzureRmContext #Resources New-AzureRmResourceGroup -Name $resourceGroup -Location $location #Billing Get-AzureRmBillingPeriod -Name 201704-1 Get-AzureRmBillingInvoice -Name 2017-02-18-432543543 Get-AzureRmBillingInvoice -Latest Get-AzureRmConsumptionBudget -ResourceGroupName RGBudgets -Name PSBudgetRG #Tag New-AzureRmTag -Name "Department" -Value "Finance" Get-AzureRmTag Get-AzureRmTag -Name "Department" Get-AzureRmTag -Detailed Remove-AzureRmTag -Name "Department" -Value "HumanResources" –PassThru #Active Directory - Create new AAD application, group, user New-AzureRmADApplication -DisplayName "NewApplication" -HomePage "http://www.microsoft.com" -IdentifierUris http://NewApplication New-AzureRmADGroup -DisplayName "MyGroupDisplayName" -MailNickname myemail@domain.com Add-AzureRmADGroupMember -MemberObjectId D9076BBC-D62C-4105-9C78-A7F5BC4A3405 -TargetGroupObjectId 85F89C90-780E-4AA6-9F4F-6F268D322EEE $SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force New-AzureRmADApplication -DisplayName "NewApplication" -HomePage "http://www.microsoft.com" -IdentifierUris "http://NewApplication" -Password $SecureStringPassword $SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force New-AzureRmADUser -DisplayName "MyDisplayName" -UserPrincipalName "myemail@domain.com" -Password $SecureStringPassword $SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force New-AzureRmADSpCredential -ObjectId 1f99cf81-0146-4f4e-beae-2007d0668476 -Password $SecureStringPassword
  • 3. Active Directory, Role Based Access Control #Service Principal New-AzureRmADServicePrincipal -Role Reader New-AzureRmADServicePrincipal -Scope /subscriptions/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz/resourceGroups/myResourceGroup New-AzureRmADServicePrincipal -ApplicationId 34a28ad2-dec4-4a41-bc3b-d22ddf90000e $SecureStringPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force New-AzureRmADServicePrincipal -DisplayName SPForNoApp -Password $SecureStringPassword Get-AzureRmADApplication -ObjectId 3ede3c26-b443-4e0b-9efc-b05e68338dc3 | New-AzureRmADServicePrincipal #Create Role $role = Get-AzureRmRoleDefinition "Virtual Machine Contributor" $role.Id = $null $role.Name = "Virtual Machine Operator" $role.Description = "Can monitor and restart virtual machines." $role.Actions.Clear() $role.Actions.Add("Microsoft.Storage/*/read") $role.Actions.Add("Microsoft.Network/*/read") $role.Actions.Add("Microsoft.Compute/*/read") $role.Actions.Add("Microsoft.Compute/virtualMachines/start/action") $role.Actions.Add("Microsoft.Compute/virtualMachines/restart/action") $role.Actions.Add("Microsoft.Authorization/*/read") $role.Actions.Add("Microsoft.Resources/subscriptions/resourceGroups/read") $role.Actions.Add("Microsoft.Insights/alertRules/*") $role.Actions.Add("Microsoft.Support/*") $role.AssignableScopes.Clear() $role.AssignableScopes.Add("/subscriptions/00000000-0000-0000-0000-000000000000") $role.AssignableScopes.Add("/subscriptions/11111111-1111-1111-1111-111111111111") New-AzureRmRoleDefinition -Role $role #Subscribtion #Create Role JSON { "Name": "Custom Role 1", "Id": null, "IsCustom": true, "Description": "Allows for read access to Azure storage and compute resources and access to support", "Actions": [ "Microsoft.Compute/*/read", "Microsoft.Storage/*/read", "Microsoft.Support/*" ], "NotActions": [ ], "AssignableScopes": [ "/subscriptions/00000000-0000-0000-0000-000000000000", "/subscriptions/11111111-1111-1111-1111-111111111111" ] } New-AzureRmRoleDefinition -InputFile "C:CustomRolescustomrole1.json" GetAzureRmRoleDefinition | ft name (Get-AzureRmRoleDefinition "Virtual Machine Contributor").actions Get-AzureRmRoleAssignment -scope "/subscriptions/f0675ec9-480d-4c2a-982a-ed97983af390" | select displayname New-AzureRmRoleAssignment -ObjectId "74b007ea-ab34-4209-981e-c538200fe251" RoleDefinitionName "Virtual Machine Contributor" -Scope "/subscriptions/f0675ec9-480d-4c2a-982a-ed97983"‑ Get-AzureRmADGroup -SearchString "Sales (Sample Group)" New-AzureRmRoleAssignment -ObjectId "74b007ea-ab34-4209-981e-c538200fe251" RoleDefinitionName "Virtual Machine Contributor" -Scope "/subscriptions/f0675ec9-480d-4c2a-982a-ed97983"‑
  • 4. Storage, SQL Database, App Service, Content Delivery Network, Key Vault #Storage New-AzureRmStorageAccount -Location Central-US -Name $storageaccount -ResourceGroupName $resourceGroup -SkuName Standard_GRS $StorageAccountKey=Get-AzureRmStorageAccountKey -ResourceGroupName SampleGroup -name SampleStore $ctx = New-AzureStorageContext -StorageAccountName $storageaccount -StorageAccountKey $StorageAccountKey.value[0] New-AzureStorageContainer -Name $storagecontainer -Context $ctx -Permission Blob #SQL New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01" $serverDNSAlias = New-AzureRmSqlServerDnsAlias -ResourceGroupName rg -ServerName serverName -DnsAliasName aliasName New-AzureRmSqlElasticPool -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ElasticPoolName "ElasticPool01" -Edition "Standard" -Dtu 400 -DatabaseDtuMin 10 -DatabaseDtuMax 100 New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01" -ElasticPoolName "ElasticPool01" New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database03" -Edition "GeneralPurpose" -Vcore 2 -ComputeGeneration "Gen4“ #App Service New-AzureRmAppServicePlan -ResourceGroupName "Default-Web-WestUS" -Name "ContosoASP" -Location "West US" -Tier "Basic" -NumberofWorkers 2 -WorkerSize "Small" New-AzureRmWebApp -ResourceGroupName Default-Web-WestUS -Name "ContosoSite" -Location "West US" -AppServicePlan "ContosoServicePlan" New-AzureRmWebAppSSLBinding -ResourceGroupName "ContosoResourceGroup" -WebAppName "ContosoWebApp" -Thumbprint "E3A38EBA60CAA1C162785A2199C3" -Name www.contoso.com New-AzureRmWebAppBackup -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -StorageAccountUrl "https://storageaccount.file.core.windows.net" New-AzureRmWebAppDatabaseBackupSetting -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -ConnectionString "MyConnectionString" -DatabaseType "SqlAzure" New-AzureRmWebAppSlot -ResourceGroupName Default-Web-WestUS -Name "ContosoSite" -AppServicePlan "ContosoServicePlan" -Slot "Slot001“ Set-AzureRmWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -HttpLoggingEnabled $true Restore-AzureRmWebAppBackup -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -StorageAccountUrl "https://storageaccount.file.core.windows.net" -BlobName "myBlob" Restart-AzureRmWebApp -ResourceGroupName "Default-Web-WestUS" -Name "ContosoSite" Start-AzureRmWebAppSlot -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp" -Slot "Slot001" --- Stop, Remove, Get Switch-AzureRmWebAppSlot -SourceSlotName "sourceslot" -DestinationSlotName "destinationslot" -ResourceGroupName "Default-Web-WestUS" -Name "ContosoWebApp“ #CDN New-AzureRmCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Sku StandardAkamai -Location "Central US" New-AzureRmCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -Location "Central US" -EndpointName cdn1 -OriginName "Contoso" -OriginHostName "www.contoso.com" $endpoint = Get-AzureRmCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -EndpointName cdnposhdoc $endpoint.IsCompressionEnabled = $true $endpoint.ContentTypesToCompress = "text/javascript","text/css","application/json" Set-AzureRmCdnEndpoint -CdnEndpoint $endpoint Unpublish-AzureRmCdnEndpointContent -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo -PurgeContent "/images/kitten.png","/video/rickroll.mp4" Publish-AzureRmCdnEndpointContent -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo -LoadContent "/images/kitten.png","/video/rickroll.mp4" Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Unpublish-AzureRmCdnEndpointContent -PurgeContent "/images/*" Stop-AzureRmCdnEndpoint -ProfileName CdnDemo -ResourceGroupName CdnDemoRG -EndpointName cdndocdemo Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Stop-AzureRmCdnEndpoint Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Start-AzureRmCdnEndpoint Remove-AzureRmCdnEndpoint -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG -EndpointName cdnposhdoc Get-AzureRmCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG | Get-AzureRmCdnEndpoint | Remove-AzureRmCdnEndpoint -Force Remove-AzureRmCdnProfile -ProfileName CdnPoshDemo -ResourceGroupName CdnDemoRG #Key Vault New-AzureRmKeyVault -VaultName 'Contoso03Vault' -ResourceGroupName 'Group14' -Location 'East US' -Sku 'Premium‘ $Policy = New-AzureKeyVaultCertificatePolicy -SecretContentType "application/x-pkcs12" -SubjectName "CN=contoso.com" -IssuerName "Self" -ValidityInMonths 6 -ReuseKeyOnRenewal Add-AzureKeyVaultCertificate -VaultName "ContosoKV01" -Name "TestCert01" -CertificatePolicy $Policy Add-AzureKeyVaultCertificateContact -VaultName "ContosoKV01" -EmailAddress "patti.fuller@contoso.com" –PassThru Add-AzureKeyVaultKey -VaultName 'contoso' -Name 'ITSoftware' -Destination 'Software' Add-AzureKeyVaultKey -VaultName 'contoso' -Name 'ITHsm' -Destination 'HSM‘ $Password = ConvertTo-SecureString -String "123" -AsPlainText -Force Import-AzureKeyVaultCertificate -VaultName "ContosoKV01" -Name "ImportCert01" -FilePath "C:UserscontosoUserDesktopimport.pfx" -Password $Password Undo-AzureKeyVaultSecretRemoval -VaultName 'MyKeyVault' -Name 'MySecret' Stop-AzureKeyVaultCertificateOperation -VaultName "Contoso01" -Name "TestCert02" -Force Backup-AzureKeyVaultCertificate -VaultName 'mykeyvault' -Name 'mycert' Backup-AzureKeyVaultKey -VaultName 'MyKeyVault' -Name 'MyCert' -OutputFile 'C:Backup.blob'
  • 5. Redis Cache, Service Bus, Event Hub, Event Grid, Media Services, Logic Apps, Stream Analytics, IoT Hub #Redis Cache Get-AzureRmRedisCache -Name "myexists“ New-AzureRmRedisCache -ResourceGroupName $resourceGroup -Name $RedisCacheName -Location $location -Sku Basic -Size 250MB New-AzureRmRedisCache -ResourceGroupName "MyGroup" -Name "MyCache" -Location "North Central US" New-AzureRmRedisCache -ResourceGroupName "MyGroup" -Name “mc1" -Location "North Central US" -Size 250MB -Sku "Standard" -RedisConfiguration @{"maxmemory-policy" = "allkeys-random"} -Force New-AzureRmRedisCacheFirewallRule -Name "mycache" -RuleName "ruleone" -StartIP "10.0.0.1" -EndIP "10.0.0.32" New-AzureRmRedisCacheKey -ResourceGroupName "ResourceGroup03" -Name "myCache" -KeyType "Primary" -Force New-AzureRmRedisCacheKey -ResourceGroupName "ResourceGroup03" -Name "myCache" -KeyType "Secondary" -Force Import-AzureRmRedisCache -ResourceGroupName "ResourceGroup13" -Name "RedisCache06" -Files @("https://mystorageaccount.blob.core.windows.net/container22/blobname?sv=2015-04- 05&sr=b&sig=caIwutG2uDa0NZ8mjdNJdgOY8%2F8mhwRuGNdICU%2B0pI4%3D&st=2016-05-27T00%3A00%3A00Z&se=2016-05-28T00%3A00%3A00Z&sp=rwd") -Force Export-AzureRmRedisCache -ResourceGroupName "ResourceGroup13" -Name "RedisCache06" -Prefix "blobprefix" -Container "https://mystorageaccount.blob.core.windows.net/container18?sv=2015-04- 05&sr=c&sig=HezZtBZ3DURmEGDduauE7pvETY4kqlPI8JCNa8ATmaw%3D&st=2016-05-27T00%3A00%3A00Z&se=2016-05-28T00%3A00%3A00Z&sp=rwdl" #Service Bus New-AzureRmServiceBusNamespace -Location $location -Name $ServiceBusname -ResourceGroupName $resourceGroup -SkuName Basic $CurrentNamespace = Get-AzureRMServiceBusNamespace -ResourceGroup $resourceGroup -NamespaceName $ServiceBusname New-AzureRmServiceBusQueue -Name $servicebusQueue -Namespace $ServiceBusname -ResourceGroupName $resourceGroup -MaxSizeInMegabytes 1024 New-AzureRmServiceBusAuthorizationRule -Name $servicebusrule -Namespace $ServiceBusname -Queue $servicebusQueue -ResourceGroupName $resourceGroup -Rights Send,listen,manage #Event Hub New-AzureRmEventHub -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Location WestUS -EventHubName MyEveNme -MessageRetentionInDays 3 -PartitionCount 2 New-AzureRmEventHubNamespace -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Location MyLocation New-AzureRmEventHubNamespace -ResourceGroupName MyResourceGroupName -NamespaceName MyNamespaceName -Location MyLocation -EnableAutoInflate -MaximumThroughputUnits 10 #Event Grid $includedEventTypes = "Microsoft.Resources.ResourceWriteFailure", "Microsoft.Resources.ResourceWriteSuccess" $labels = "Finance", "HR" New-AzureRmEventGridSubscription -Endpoint https://requestb.in/19qlscd1 -EventSubscriptionName ESub1 -SubjectBeginsWith "TestPrefix" -SubjectEndsWith "TestSuffix" -IncludedEventType $includedEventTypes -Label $labels New-AzureRmEventGridTopic -ResourceGroupName MyResourceGroupName -Name Topic1 -Location westus2 -Tag @{ Department="Finance"; Environment="Test" } New-AzureRmEventGridTopicKey -ResourceGroup MyResourceGroupName -TopicName Topic1 -KeyName key1 #Logic Apps $Workflow = Get-AzureRmLogicApp -ResourceGroupName "ResourceGroup11" -Name "LogicApp03" New-AzureRmLogicApp -ResourceGroupName "ResourceGroup11" -Name "LogicApp13" -State "Enabled" -AppServicePlan "SePlan01" -Definition $Workflow.Definition -Parameters $Workflow.Parameters #Media Services New-AzureRmMediaService -ResourceGroupName $ResourceGroupName -AccountName $MediaServiceName -Location $Location -StorageAccountId $StorageAccount.Id -Tags $Tags #Stream Analytics New-AzureRmStreamAnalyticsJob -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:JobDefinition.json“ New-AzureRmStreamAnalyticsJob -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:JobDefinition.json" -Name "StreamingJob" –Force New-AzureRmStreamAnalyticsInput -ResourceGroupName "StreamAnalytics-Default-West-US" -JobName "StreamingJob" -File "C:Input.json" -Name "EntryStream“ New-AzureRmStreamAnalyticsOutput -ResourceGroupName "StreamAnalytics-Default-West-US" -File "C:Output.json" -JobName "StreamingJob" -Name "Output“ #IoT Hub New-AzureRmIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName "S1" -Units 1 -Location "northeurope" -Properties $properties New-AzureRmIotHubExportDevices -ResourceGroupName "myresourcegroup" -Name "myiothub" -ExportBlobContainerUri "https://mystorageaccount.blob.core.windows.net/?sv=2015-04- 05&ss=bfqt&sr=c&srt=sco&sp=rwdl&se=2016-10-27T04:01:48Z&st=2016-10-26T20:01:48Z&spr=https&sig=QqpIhHsIMF8hNuFO%3D" -ExcludeKeys $true New-AzureRmIotHubImportDevices -ResourceGroupName "myresourcegroup" -Name "myiothub" -InputBlobContainerUri "https://mystorageaccount.blob.core.windows.net/?sv=2015-04- 05&ss=bfqt&sr=c&srt=sco&sp=rwdl&se=2016-10-27T04:01:48Z&st=2016-10-26T20:01:48Z&spr=https&sig=QqpIhHsIMF8hNuFO%3D" -OutputBlobContainerUri "https://mystorageaccount.blob.core.windows.net/?sv=2015-04-05&ss=bfqt&sr=c&srt=sco&sp=rwdl&se=2016-10-27T04:01:48Z&st=2016-10-26T20:01:48Z&spr=https&sig=QqpIhHsIMF8hNuFO%3D" Set-AzureRmIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -EventHubRetentionTimeInDays 4 Set-AzureRmIotHub -ResourceGroupName "myresourcegroup" -Name "myiothub" -SkuName S1 -Units 5 Add-AzureRmIotHubCertificate -ResourceGroupName "myresourcegroup" -Name "myiothub" -CertificateName "mycertificate" -Path "c:mycertificate.cer" -Etag "AAAAAAFPazE="
  • 6. Virtual Network, Subnet, Network Gateway, Express Route, Network Security Group, Virtual Machine, DiSK #Virtual Network $subnetConfig1= New-AzureRmVirtualNetworkSubnetConfig -Name publicSubnet -AddressPrefix 192.168.0.0/24 -ServiceEndpoint Microsoft.sql $vnetName = "BridgelabzVnet" $vnet = New-AzureRmVirtualNetwork -ResourceGroupName $resourceGroup -Location $location -Name $vnetName -AddressPrefix 192.168.0.0/16 -Subnet $subnetConfig1 #Network Gateway New-AzureRmLocalNetworkGateway -Name Site1 -ResourceGroupName TestRG1 ` -Location 'East US' -GatewayIpAddress '23.99.221.164' -AddressPrefix '10.101.0.0/24‘ $gw = Get-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG Resize-AzureRmVirtualNetworkGateway -VirtualNetworkGateway $gw -GatewaySku HighPerformance Remove-AzureRmVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG New-AzureRmVirtualNetworkGatewayConnection -Name $Connection41 -ResourceGroupName $RG4 ` -VirtualNetworkGateway1 $vnet4gw -VirtualNetworkGateway2 $vnet1gw -Location $Location4 ` -ConnectionType Vnet2Vnet -SharedKey 'AzureA1b2C3‘ #Express Route $circuit = Get-AzureRmExpressRouteCircuit -Name "MyCircuit" -ResourceGroupName "MyRG" $gw = Get-AzureRmVirtualNetworkGateway -Name "ExpressRouteGw" -ResourceGroupName "MyRG" $connection = New-AzureRmVirtualNetworkGatewayConnection -Name "ERConnection" -ResourceGroupName "MyRG" -Location "East US" -VirtualNetworkGateway1 $gw -PeerId $circuit.Id -ConnectionType ExpressRoute New-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup" -Location "West US" -SkuTier Standard -SkuFamily MeteredData -ServiceProviderName "Equinix" -PeeringLocation "Silicon Valley" -BandwidthInMbps 200 Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup“ $ckt = Get-AzureRmExpressRouteCircuit -Name "ExpressRouteARMCircuit" -ResourceGroupName "ExpressRouteResourceGroup" $ckt.ServiceProviderProperties.BandwidthInMbps = 1000 $ckt.Sku.Family = "UnlimitedData" $ckt.sku.Name = "Premium_UnlimitedData" Set-AzureRmExpressRouteCircuit -ExpressRouteCircuit $ckt Remove-AzureRmExpressRouteCircuit -ResourceGroupName "ExpressRouteResourceGroup" -Name "ExpressRouteARMCircuit" #Network Security Group, Interface $rule1 = New-AzureRmNetworkSecurityRuleConfig -Name rdp-rule -Description "Allow RDP" -Access Allow -Protocol Tcp -Direction Inbound -Priority 100 ` -SourceAddressPrefix Internet -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange 3389 $nsgapp = New-AzureRmNetworkSecurityGroup -ResourceGroupName $resourceGroup -Location $location -Name appnsg -SecurityRules $rule1 $nic1=New-AzureRmNetworkInterface -ResourceGroupName $resourceGroup -Location $location -Name appNic -Subnet $vnet.Subnets[0] -NetworkSecurityGroup $nsgapp -LoadBalancerBackendAddressPool $apppool -LoadBalancerInboundNatRule $appinboundNATRule #Virtual Machine $appvmConfig = New-AzureRmVMConfig -VMName $vmName1 -VMSize Standard_B2s -AvailabilitySetId $appset.Id | ` Set-AzureRmVMOperatingSystem -Windows -ComputerName $vmName1 -Credential $cred | ` Set-AzureRmVMSourceImage -PublisherName MicrosoftWindowsServer -Offer WindowsServer -Skus 2016-Datacenter -Version latest | ` Add-AzureRmVMNetworkInterface -Id $nic1.Id New-AzureRmVM -ResourceGroupName $resourceGroup -Location $location -VM $appvmConfig New-AzureRmVm -ResourceGroupName "myResourceGroupAutomate" -Name "myVM" -Location "East US" -VirtualNetworkName "myVnet" -SubnetName "mySubnet" -SecurityGroupName "myNetworkSecurityGroup" -PublicIpAddressName "myPublicIpAddress" -OpenPorts 80 -Credential $cred Start-AzureRmVm -ResourceGroupName $resgroupname -Name $vmname Stop-AzureRmVm -ResourceGroupName $resgroupname -Name $vmname -Force Get-AzureRmPublicIPAddress -ResourceGroupName "myResourceGroupAutomate" -Name "myPublicIPAddress" | select IpAddress #Disk $rgName = 'myResourceGroup‘ | $vmName = 'myVM‘ | $location = 'East US' | $storageType = 'Premium_LRS‘ | $dataDiskName = $vmName + '_datadisk1‘ $diskConfig = New-AzureRmDiskConfig -SkuName $storageType -Location $location -CreateOption Empty -DiskSizeGB 128 $dataDisk1 = New-AzureRmDisk -DiskName $dataDiskName -Disk $diskConfig -ResourceGroupName $rgName $vm = Get-AzureRmVM -Name $vmName -ResourceGroupName $rgName $vm = Add-AzureRmVMDataDisk -VM $vm -Name $dataDiskName -CreateOption Attach -ManagedDiskId $dataDisk1.Id -Lun 1 Update-AzureRmVM -VM $vm -ResourceGroupName $rgName $VirtualMachine = Get-AzureRmVM -ResourceGroupName "RG11" -Name "MyVM07" Remove-AzureRmVMDataDisk -VM $VirtualMachine -Name "DataDisk3" Update-AzureRmVM -ResourceGroupName "RG11" -VM $VirtualMachine
  • 7. Virtual Machine Extension, Scale Set, VHD #Virtual Machine Extension Set-AzureRmVMExtension -ResourceGroupName "myResourceGroupAutomate" -ExtensionName "IIS" -VMName "myVM" -Location "EastUS" ` -Publisher Microsoft.Compute -ExtensionType CustomScriptExtension -TypeHandlerVersion 1.8 ` -SettingString '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path "C:inetpubwwwrootDefault.htm" -Value $($env:computername)"}‘ Set-AzureRmVMCustomScriptExtension -ResourceGroupName $resourcegroup -VMName $vmName1 -Name "NotesCustomScript" -FileUri $appblobUrl -Run "NotesAPPVM.ps1" -Location $location ********NotesAPPVM.ps1 Add-WindowsFeature Web-Server -IncludeManagementTools -includeallsubfeature Set-WebBinding -Name "Default Web Site" -BindingInformation "*:80:" -PropertyName Port -Value 1234 $rediskey='fundooredis.redis.cache.windows.net:6380,password=2TIr6mEkZwLJi+VmOT2NS+9u9UkHmjtVcN8KXK+LmzM=,ssl=True,abortConnect=False' $servicebuskey='Endpoint=sb://fundoobus.servicebus.windows.net/;SharedAccessKeyName=ReminderPolicy;SharedAccessKey=XujChsUu789yJmF8T9OGgeEujIgMzwKT7ATDYbTjAbQ=;EntityPath=remi nder‘ [Environment]::SetEnvironmentVariable("RedisCache",$rediskey , "Machine") [Environment]::SetEnvironmentVariable("ServiceBus",$servicebuskey , "Machine") ********************* #Virtual Machine Scale Set New-AzureRmVmss -ResourceGroupName "myResourceGroupScaleSet" -Location "EastUS" -VMScaleSetName "myScaleSet" -VirtualNetworkName "myVnet" -SubnetName "mySubnet" ` -PublicIpAddressName "myPublicIPAddress" -LoadBalancerName "myLoadBalancer" -UpgradePolicy "Automatic“ $publicSettings = @{ "fileUris" = (,"https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/automate-iis.ps1"); "commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File automate-iis.ps1" } $vmss = Get-AzureRmVmss -ResourceGroupName "myResourceGroupScaleSet" -VMScaleSetName "myScaleSet“ Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name "customScript" -Publisher "Microsoft.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion 1.8 -Setting $publicSettings Update-AzureRmVmss -ResourceGroupName "myResourceGroupScaleSet" -Name "myScaleSet" -VirtualMachineScaleSet $vmss Get-AzureRmVmssVM -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0“ $vmss = Get-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet“ $vmss.sku.capacity = 5 Update-AzureRmVmss -ResourceGroupName "myResourceGroup" -Name "myScaleSet" -VirtualMachineScaleSet $vmss Get-AzureRmVmssVM -ResourceGroupName "myResourceGroupScaleSet" -VMScaleSetName "myScaleSet“ Get-AzureRmVmssVM -ResourceGroupName "myResourceGroupScaleSet" -VMScaleSetName "myScaleSet" -InstanceId "1" Start-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0" Stop-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0“ #Scale Down Rule $myScaleProfile = New-AzureRmAutoscaleProfile -DefaultCapacity 2 -MaximumCapacity 10 -MinimumCapacity 2 -Rules $myRuleScaleUp,$myRuleScaleDown -Name "autoprofile" Add-AzureRmAutoscaleSetting -Location $myLocation -Name "autosetting" -ResourceGroup $myResourceGroup -TargetResourceId $myScaleSetId -AutoscaleProfiles $myScaleProfile Restart-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0" Remove-AzureRmVmss -ResourceGroupName "myResourceGroup" -VMScaleSetName "myScaleSet" -InstanceId "0“ #VHD Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -Overwrite Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -NumberOfUploaderThreads 32 Add-AzureRmVhd -Destination "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd?st=2013-01 -09T22%3A15%3A49Z&se=2013-01- 09T23%3A10%3A49Z&sr=b&sp=w&sig=13T9Ow%2FRJAMmhfO%2FaP3HhKKJ6AY093SmveO SIV4%2FR7w%3D" -LocalFilePath "C:vhdwin7baseimage.vhd“ ConvertTo-AzureRmVhd -HyperVVMName 'test' -ExportPath '.'; .testVirtual Hard DisksConvertedos.vhd .testVirtual Hard DisksConverteddisk.vhd Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -ResourceGroupName "rgname" Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -Overwrite -ResourceGroupName "rgname" Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -NumberOfThreads 32 -ResourceGroupName "rgname" Save-AzureRmVhd -SourceUri "http://contosoaccount.blob.core.windows.net/vhdstore/win7baseimage.vhd" -LocalFilePath "C:vhdWin7Image.vhd" -StorageKey "zNvcH0r5vAGmC5AbwEtpcyWCMyBd3eMDbdaa4ua6kwxq6vTZH3Y+sw==" -ResourceGroupName "rgname"
  • 8. Traffic Manager #Traffic Manager $profiles = Get-AzureTrafficManagerProfile $profiles | Format-Table $profile = Get-AzureTrafficManagerProfile -Name "MyProfile" $profile | Format-List $profile.Endpoints | Format- $profile = New-AzureTrafficManagerProfile -Name "MyProfile" -DomainName "myprofile.trafficmanager.net" -LoadBalancingMethod "RoundRobin" -Ttl 30 -MonitorProtocol "Http" -MonitorPort 80 -MonitorRelativePath "/" $profile = Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "myapp-eu.cloudapp.net" -Status "Enabled" -Type "CloudService" $profile = Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "myapp-us.cloudapp.net" -Status "Enabled" -Type "CloudService" Set-AzureTrafficManagerProfile –TrafficManagerProfile $profile New-AzureTrafficManagerProfile -Name "MyProfile" -DomainName "myprofile.trafficmanager.net" -LoadBalancingMethod "RoundRobin" -Ttl 30 -MonitorProtocol "Http" -MonitorPort 80 -MonitorRelativePath "/" | Add-AzureTrafficManagerEndpoint -DomainName "myapp-eu.cloudapp.net" -Status "Enabled" -Type "CloudService" | Add-AzureTrafficManagerEndpoint -DomainName "myapp-us.cloudapp.net" -Status "Enabled" -Type "CloudService" | Set-AzureTrafficManagerProfile New-AzureRmTrafficManagerEndpoint -Name eu-endpoint -ProfileName MyProfile -ResourceGroupName MyRG -Type ExternalEndpoints -Target app-eu.contoso.com -EndpointStatus Enabled $child = New-AzureRmTrafficManagerProfile -Name child -ResourceGroupName MyRG -TrafficRoutingMethod Priority -RelativeDnsName child -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/" $parent = New-AzureRmTrafficManagerProfile -Name parent -ResourceGroupName MyRG -TrafficRoutingMethod Performance -RelativeDnsName parent -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/" Add-AzureRmTrafficManagerEndpointConfig -EndpointName child-endpoint -TrafficManagerProfile $parent -Type NestedEndpoints -TargetResourceId $child.Id -EndpointStatus Enabled -EndpointLocation "North Europe" -MinChildEndpoints 2 Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile $child = Get-AzureRmTrafficManagerEndpoint -Name child -ResourceGroupName MyRG New-AzureRmTrafficManagerEndpoint -Name child-endpoint -ProfileName parent -ResourceGroupName MyRG -Type NestedEndpoints -TargetResourceId $child.Id -EndpointStatus Enabled -EndpointLocation "North Europe" -MinChildEndpoints 2 Set-AzureRmContext -SubscriptionId $EndpointSubscription $ip = Get-AzureRmPublicIpAddress -Name $IpAddresName -ResourceGroupName $EndpointRG Set-AzureRmContext -SubscriptionId $trafficmanagerSubscription New-AzureRmTrafficManagerEndpoint -Name $EndpointName -ProfileName $ProfileName -ResourceGroupName $TrafficManagerRG -Type AzureEndpoints -TargetResourceId $ip.Id -EndpointStatus Enabled $profile = New-AzureRmTrafficManagerProfile -Name FundooTraffic -ResourceGroupName $resourcegroup -TrafficRoutingMethod Performance -RelativeDnsName fundootraffic -Ttl 30 -MonitorProtocol HTTP -MonitorPort 80 -MonitorPath "/" $applb = Get-AzureRmPublicIpAddress -Name applbip -ResourceGroupName $resourcegroup Add-AzureRmTrafficManagerEndpointConfig -EndpointName applbEndpoint -TrafficManagerProfile $profile -Type AzureEndpoints -TargetResourceId $applb.Id -EndpointStatus Enabled Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile #Update Endpoints $profile = Get-AzureTrafficManagerProfile -Name "MyProfile" $profile.MonitorRelativePath = "/monitor.aspx" Set-AzureTrafficManagerProfile –TrafficManagerProfile $profile $endpoint = Get-AzureRmTrafficManagerEndpoint -Name myendpoint -ProfileName myprofile -ResourceGroupName MyRG -Type ExternalEndpoints $endpoint.Weight = 20 Set-AzureRmTrafficManagerEndpoint -TrafficManagerEndpoint $endpoint $profile = Get-AzureRmTrafficManagerProfile -Name myprofile -ResourceGroupName MyRG $profile.Endpoints[0].Priority = 2 $profile.Endpoints[1].Priority = 1 Set-AzureRmTrafficManagerProfile -TrafficManagerProfile $profile Disable-AzureTrafficManagerProfile -Name "MyProfile" Enable-AzureTrafficManagerProfile -Name "MyProfile“ Remove-AzureTrafficManagerProfile -Name "MyProfile" -Force
  • 9. Load balancer, Monitor, Data Store, Lake, Analytics #Load Balancer #Public Load Balancer $APPLBIP = New-AzureRmPublicIpAddress -Name applbip -ResourceGroupName $resourceGroup -Location $location -AllocationMethod Static -DomainNameLabel $DomainNameLabel $appfrontendIP = New-AzureRmLoadBalancerFrontendIpConfig -Name APP-LB-Frontend -PublicIpAddress $APPLBIP $apppool = New-AzureRmLoadBalancerBackendAddressPoolConfig -Name APP-LB-backend $appinboundNATRule= New-AzureRmLoadBalancerInboundNatRuleConfig -Name APPRDP -FrontendIpConfiguration $appfrontendIP -Protocol TCP -FrontendPort 3441 -BackendPort 3389 $apphealthProbe = New-AzureRmLoadBalancerProbeConfig -Name APPHealthProbe -RequestPath / -Protocol http -Port 80 -IntervalInSeconds 15 -ProbeCount 2 $applbrule = New-AzureRmLoadBalancerRuleConfig -Name APPHTTP -FrontendIpConfiguration $appfrontendIP -BackendAddressPool $appPool -Probe $apphealthProbe -Protocol Tcp -FrontendPort 80 -BackendPort 80 $APPLB = New-AzureRmLoadBalancer -ResourceGroupName $resourceGroup -Name applb -Location $location -FrontendIpConfiguration $appfrontendIP -InboundNatRule $appinboundNATRule -LoadBalancingRule $applbrule -BackendAddressPool $appPool -Probe $apphealthProbe #Private Load Balancer $apifrontendIP = New-AzureRmLoadBalancerFrontendIpConfig -Name API-LB-Frontend -PrivateIpAddress 192.168.0.110 -SubnetId $vnet.subnets[0].Id $apipool= New-AzureRmLoadBalancerBackendAddressPoolConfig -Name API-LB-backend $apiinboundNATRule= New-AzureRmLoadBalancerInboundNatRuleConfig -Name "RDP1" -FrontendIpConfiguration $apifrontendIP -Protocol TCP -FrontendPort 3442 -BackendPort 3389 $apihealthProbe= New-AzureRmLoadBalancerProbeConfig -Name "APIHealthProbe" -RequestPath / -Protocol http -Port 80 -IntervalInSeconds 15 -ProbeCount 2 $apilbrule = New-AzureRmLoadBalancerRuleConfig -Name "APIHTTP" -FrontendIpConfiguration $apifrontendIP -BackendAddressPool $apiPool -Probe $apihealthProbe -Protocol Tcp -FrontendPort 80 -BackendPort 80 $APILB = New-AzureRmLoadBalancer -ResourceGroupName $resourceGroup -Name apilb -Location $location -FrontendIpConfiguration $apifrontendIP -InboundNatRule $apiinboundNATRule -LoadBalancingRule $apilbrule -BackendAddressPool $apiPool -Probe $apihealthProbe #Monitor New-AzureRmApplicationInsights -Kind java -ResourceGroupName testgroup -Name test1027 -location eastus New-AzureRmAutoscaleNotification -CustomEmails "pattif@contoso.com, davidchew@contoso.net" #Create a profile with no schedule or fixed date $Rule = New-AzureRmAutoscaleRule -MetricName "Requests" -MetricResourceId "/subscriptions/b93fb07a-6f93-30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web- EastUS/providers/microsoft.web/sites/mywebsite" -Operator GreaterThan -MetricStatistic Average -Threshold 10 -TimeGrain 00:01:00 -ScaleActionCooldown 00:05:00 -ScaleActionDirection Increase -ScaleActionScaleType ChangeCount -ScaleActionValue "1" $Profile = New-AzureRmAutoscaleProfile -DefaultCapacity "1" -MaximumCapacity "10" -MinimumCapacity "1" -Rules $Rule -Name "ProfileName“ New-AzureRmAlertRuleEmail -CustomEmails pattif@contoso.com,davidchew@contoso.net Add-AzureRmMetricAlertRule -Name "metricRule5" -Location "East US" -ResourceGroup "Default-Web-EastUS" -Operator GreaterThan -Threshold 1 -TargetResourceId "/subscriptions/b93fb07a-6f93- 30be-bf3e-4f0deca15f4f/resourceGroups/Default-Web-EastUS/providers/microsoft.web/sites/mywebsite" -MetricName "Requests" -TimeAggregationOperator Total Add-AzureRmLogProfile -Locations "Global","West US" -Name ExportLogProfile -StorageAccountId /subscriptions/40gpe80s-9sb7-4f07-9042- b1b6a92ja9fk/resourceGroups/activitylogRG/providers/Microsoft.Storage/storageAccounts/activitylogstorageaccount Disable-AzureRmActivityLogAlert -Name "alert1" -ResourceGroupName "Default-ActivityLogsAlerts“ #Data Lake Analytics, Store, Lake New-AzureRmDataLakeAnalyticsAccount -Name "ContosoAdlAccount" -ResourceGroupName "ContosoOrg" -Location "East US 2" -DefaultDataLakeStore "ContosoAdlStore" New-AzureRmDataLakeAnalyticsCatalogCredential -AccountName "ContosoAdlAccount" -DatabaseName "databaseName" -CredentialName "exampleDbCred" -Credential (Get-Credential) -DatabaseHost "example.contoso.com" -Port 8080 Add-AzureRmDataLakeAnalyticsDataSource -Account "ContosoAdlA" -DataLakeStore "ContosoAdlS" Set-AzureRmDataLakeAnalyticsDataSource -Account "ContosoAdlAccount" -Blob "contosowasb" -AccessKey "...newaccesskey...“ New-AzureRmDataLakeStoreAccount -Name "ContosoADL" -ResourceGroupName "ContosoOrg" -Location "East US 2" New-AzureRmDataLakeStoreItem -AccountName "ContosoADL" -Path "/NewFile.txt" New-AzureRmDataLakeStoreItem -AccountName "ContosoADL" -Path "/NewFolder" –Folder Set-AzureRmDataLakeStoreItemExpiry -AccountName "ContosoADL" -Path /myfile.txt -Expiration [DateTimeOffset]::Now.AddHours(2) Add-AzureRmDataLakeStoreItemContent -AccountName "ContosoADLS" -Path /abc/myFile.txt -Value "My content here“ New-AzureRmDmsConnInfo -ServerType SQL -DataSource mySourceServer -AuthType SqlAuthentication -TrustServerCertificate:$true New-AzureRmDataMigrationDatabaseInfo -SourceDatabaseName 'AdventureWorks2016' New-AzureRmDmsFileShare -Path $fileSharePath -Credential $fileShareCred New-AzureRmDataMigrationProject -ResourceGroupName MyResourceGroup -ServiceName TestService -ProjectName MyDMSProject -Location "central us" -SourceType SQL -TargetType SQLDB -SourceConnection $sourceConnInfo -TargetConnection $targetConnInfo -DatabaseInfo $dbList New-AzureRmDataMigrationSelectedDB -MigrateSqlServerSqlDb -Name "HR" -TargetDatabaseName "HR_PSTEST" -TableMap $tableMap New-AzureRmDataMigrationSelectedDB -MigrateSqlServerSqlDbMi -Name "HR" -TargetDatabaseName "HR_PSTEST" -BackupFileShare $backupFileShare
  • 10. Power BI, Automation #PowerBI New-AzureRmPowerBIEmbeddedCapacity -ResourceGroupName "testRG" -Name "testcapacity" -Location "West Central US" -Sku "A1" -Administrator admin@microsoft.com New-AzureRmPowerBIWorkspaceCollection -ResourceGroupName "ResourceGroup17" -WorkspaceCollectionName "WCN11" -Location "Japan West“ #Automation New-AzureRmAutomationAccount -Name "ContosoAutomationAccount" -Location "East US" -ResourceGroupName "ResourceGroup01“ $FieldValues = @{"AutomationCertificateName"="ContosoCertificate";"SubscriptionID"="81b59010-dc55-45b7-89cd-5ca26db62472"} New-AzureRmAutomationConnection -Name "Connection12" -ConnectionTypeName Azure -ConnectionFieldValues $FieldValues -ResourceGroupName "ResourceGroup01" -AutomationAccountName "AutomationAccount01" New-AzureRmAutomationModule -AutomationAccountName "Contoso17" -Name "ContosoModule" -ContentLink "http://contosostorage.blob.core.windows.net/modules/ContosoModule.zip" -ResourceGroupName "ResourceGroup01“ New-AzureRmAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbook02" -ResourceGroupName "ResourceGroup01“ #Schedule $ $TimeZone = ([System.TimeZoneInfo]::Local)Id New-AzureRmAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule01" -StartTime "23:00" -OneTime -ResourceGroupName "ResourceGroup01" -TimeZone $TimeZone #Schedule – Recurring $StartTime = Get-Date "13:00:00" $EndTime = $StartTime.AddYears(1) New-AzureRmAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule02" -StartTime $StartTime -ExpiryTime $EndTime -DayInterval 1 -ResourceGroupName "ResourceGroup01“ #Backup New-AzureRmBackupVault -ResourceGroupName "ResourceGroup02" -Name "Vault03" -Region "westus" -Storage LocallyRedundant $Vault = Get-AzureRmBackupVault -Name "Vault03" Register-AzureRmBackupContainer -Vault $Vault -Name "Contoso03Vm" -ServiceName "ContosoService27“ #Batch – Job $PoolInformation = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSPoolInformation" $PoolInformation.PoolId = "Pool22" New-AzureBatchJob -Id "ContosoJob35" -PoolInformation $PoolInformation -BatchContext $Context #Batch – Schedule $Schedule = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSSchedule" $Schedule.RecurrenceInterval = [TimeSpan]::FromDays(1) $JobSpecification = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSJobSpecification" $JobSpecification.PoolInformation = New-Object -TypeName "Microsoft.Azure.Commands.Batch.Models.PSPoolInformation" $JobSpecification.PoolInformation.PoolId = "ContosoPool06" New-AzureBatchJobSchedule -Id "JobSchedule17" -Schedule $Schedule -JobSpecification $JobSpecification -BatchContext $Context